| 69 | } |
| 70 | |
| 71 | ClientCheckResult ProxyClientInfo::check() { |
| 72 | if (charging_now()) { |
| 73 | return ClientCheckResult::Ok; |
| 74 | } |
| 75 | |
| 76 | if (is_closed()) { |
| 77 | if (running_queries() > 0) { |
| 78 | return ClientCheckResult::Ok; |
| 79 | } |
| 80 | |
| 81 | return ClientCheckResult::Ok; |
| 82 | } |
| 83 | |
| 84 | if (is_closing() && tokens_max() == tokens_committed_to_blockchain() && running_queries() == 0) { |
| 85 | runner_->client_charge(*this, true); |
| 86 | return ClientCheckResult::Ok; |
| 87 | } else { |
| 88 | auto delta = tokens_ready_to_charge(); |
| 89 | if (delta == 0) { |
| 90 | return ClientCheckResult::Ok; |
| 91 | } |
| 92 | if (delta * runner_->price_per_token() >= runner_->min_client_charge_sum()) { |
| 93 | runner_->client_charge(*this, false); |
| 94 | return ClientCheckResult::Ok; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | return ClientCheckResult::Ok; |
| 99 | } |
| 100 | |
| 101 | ton::tl_object_ptr<cocoon_api::client_paymentStatus> ProxyClientInfo::serialize_payment_status() { |
| 102 | runner_->sign_client_payment(*this); |
nothing calls this directly
no test coverage detected