MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / process_signed_payment_data

Method process_signed_payment_data

runners/client/ClientProxyInfo.cpp:117–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void 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
138void ClientProxyInfo::store_stats(td::StringBuilder &sb) {
139 auto price_per_token = sc_->runner_config()->root_contract_config->price_per_token();

Callers 4

receive_messageMethod · 0.80
register_proxyMethod · 0.80
process_auth_answerMethod · 0.80

Calls 2

as_sliceMethod · 0.80

Tested by

no test coverage detected