Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Do not subjectively bill when producing a block. This avoids double b…
Browse files Browse the repository at this point in the history
…ill.
  • Loading branch information
heifner committed Jan 22, 2021
1 parent 940f94c commit 8945acb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin
}

auto first_auth = trx->packed_trx()->get_transaction().first_authorizer();
uint32_t sub_bill = _subjective_billing.get_subjective_bill( first_auth );
uint32_t sub_bill = 0;
if( _pending_block_mode != pending_block_mode::producing)
sub_bill = _subjective_billing.get_subjective_bill( first_auth );

auto trace = chain.push_transaction( trx, deadline, trx->billed_cpu_time_us, false, sub_bill );
if( trace->except ) {
Expand Down Expand Up @@ -1814,7 +1816,8 @@ bool producer_plugin_impl::process_unapplied_trxs( const fc::time_point& deadlin
deadline_is_subjective = true;
trx_deadline = deadline;
}
uint32_t sub_bill = _subjective_billing.get_subjective_bill( first_auth );
// no subjective billing since we are producing or processing persisted trxs
const uint32_t sub_bill = 0;

auto trace = chain.push_transaction( trx, trx_deadline, prev_billed_cpu_time_us, false, sub_bill );
if( trace->except ) {
Expand Down

0 comments on commit 8945acb

Please sign in to comment.