148 {
149 if( _disabled || _disabled_accounts.count( first_auth ) ) return 0;
150 const auto time_ordinal = time_ordinal_for(now);
151 const subjective_billing_info* sub_bill_info = nullptr;
152 auto aitr = _account_subjective_bill_cache.find( first_auth );
153 if( aitr != _account_subjective_bill_cache.end() ) {
154 sub_bill_info = &aitr->second;
155 }
156 uint64_t in_block_pending_cpu_us = 0;
157 auto bitr = _block_subjective_bill_cache.find( first_auth );
158 if( bitr != _block_subjective_bill_cache.end() ) {
159 in_block_pending_cpu_us = bitr->second;
160 }
161
162 if (sub_bill_info) {
163 SYS_ASSERT(sub_bill_info->pending_cpu_us >= in_block_pending_cpu_us, chain::tx_resource_exhaustion,
"Logic error subjective billing ${a}", (
"a", first_auth) );
164 int64_t sub_bill = sub_bill_info->pending_cpu_us - in_block_pending_cpu_us + sub_bill_info->expired_accumulator.value_at(time_ordinal, _expired_accumulator_average_window );
165 return sub_bill;
166 } else {
167 return 0;
168 }
169 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
unsigned __int64 uint64_t