| 115 | } |
| 116 | |
| 117 | void ClientProxyInfo::process_signed_payment_data(cocoon_api::proxy_SignedPayment &data) { |
| 118 | if (data.get_id() == cocoon_api::proxy_signedPaymentEmpty::ID) { |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | auto &d = static_cast<cocoon_api::proxy_signedPayment &>(data); |
| 123 | |
| 124 | auto R = sc_->check_signed_pay_message(d.data_.as_slice()); |
| 125 | if (R.is_error()) { |
| 126 | LOG(ERROR) << "received incorrect signed pay message: " << R.move_as_error(); |
| 127 | return; |
| 128 | } |
| 129 | |
| 130 | auto tokens = R.move_as_ok(); |
| 131 | |
| 132 | if (tokens > tokens_used_proxy_committed_to_blockchain_) { |
| 133 | tokens_used_proxy_committed_to_blockchain_ = tokens; |
| 134 | signed_charge_message_ = td::UniqueSlice(d.data_.as_slice()); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void ClientProxyInfo::store_stats(td::StringBuilder &sb) { |
| 139 | auto price_per_token = sc_->runner_config()->root_contract_config->price_per_token(); |
no test coverage detected