diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index b17d1f45b37..bd1f14f6aff 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -205,14 +205,6 @@ class subjective_billing { } } - void remove_subjective_billing( const branch_type& forked_branch ) { - if( !_trx_cache_index.empty() ) { - for( const auto& bsp : forked_branch ) { - remove_subjective_billing( bsp ); - } - } - } - void subjective_bill( const packed_transaction& pt, const fc::microseconds& elapsed, bool speculative ) { if( !_disabled ) { uint32_t bill = std::max( 0, elapsed.count() ); @@ -226,7 +218,7 @@ class subjective_billing { _account_subjective_bill_cache[first_auth] += bill; if( speculative ) { // if speculative then we have billed user until block is aborted - _block_subjective_bill_cache[first_auth] += elapsed.count(); + _block_subjective_bill_cache[first_auth] += bill; } } } @@ -521,7 +513,6 @@ class producer_plugin_impl : public std::enable_shared_from_thispacked_trx(), trace->elapsed, - chain.get_read_mode() == chain::db_read_mode::SPECULATIVE ); - } + _subjective_billing.subjective_bill( *trx->packed_trx(), trace->elapsed, + chain.get_read_mode() == chain::db_read_mode::SPECULATIVE ); } send_response( trace ); } @@ -1984,10 +1973,8 @@ bool producer_plugin_impl::process_unapplied_trxs( const fc::time_point& deadlin continue; } } else { - if( _pending_block_mode != pending_block_mode::producing ) { - _subjective_billing.subjective_bill( *trx->packed_trx(), trace->elapsed, - chain.get_read_mode() == chain::db_read_mode::SPECULATIVE ); - } + _subjective_billing.subjective_bill( *trx->packed_trx(), trace->elapsed, + chain.get_read_mode() == chain::db_read_mode::SPECULATIVE ); ++num_applied; if( itr->trx_type != trx_enum_type::persisted ) { if( itr->next ) itr->next( trace );