提交 6e9b4419 编写于 作者: A arhag

initial setup of billing CPU for signatures recovered earlier

上级 3e733f57
......@@ -998,7 +998,20 @@ struct controller_impl {
transaction_trace_ptr trace;
try {
transaction_context trx_context(self, trx->trx, trx->id);
auto start = fc::time_point::now();
if( !explicit_billed_cpu_time ) {
int64_t cpu_per_signature_us = 10; // TODO: plumb in producer configuration for this value.
auto already_consumed_time = fc::microseconds( cpu_per_signature_us * trx->trx.signatures.size() );
// Alternatively store actual time to recover keys in transaction_metadata and use that as already_consumed_time (makes more sense if recovery cache was removed).
if( start.time_since_epoch() < already_consumed_time ) {
start = fc::time_point();
} else {
start -= already_consumed_time;
}
}
transaction_context trx_context(self, trx->trx, trx->id, start);
if ((bool)subjective_cpu_leeway && pending->_block_status == controller::block_status::incomplete) {
trx_context.leeway = *subjective_cpu_leeway;
}
......@@ -1014,7 +1027,6 @@ struct controller_impl {
bool skip_recording = replay_head_time && (time_point(trx->trx.expiration) <= *replay_head_time);
trx_context.init_for_input_trx( trx->packed_trx->get_unprunable_size(),
trx->packed_trx->get_prunable_size(),
trx->trx.signatures.size(),
skip_recording);
}
......
......@@ -33,7 +33,6 @@ namespace eosio { namespace chain {
void init_for_input_trx( uint64_t packed_trx_unprunable_size,
uint64_t packed_trx_prunable_size,
uint32_t num_signatures,
bool skip_recording);
void init_for_deferred_trx( fc::time_point published );
......
......@@ -284,7 +284,6 @@ namespace bacc = boost::accumulators;
void transaction_context::init_for_input_trx( uint64_t packed_trx_unprunable_size,
uint64_t packed_trx_prunable_size,
uint32_t num_signatures,
bool skip_recording )
{
const auto& cfg = control.get_global_properties().configuration;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册