adjust undo buffer based upon last_irreversible_block_num

This commit is contained in:
Daniel Larimer 2015-10-05 09:46:02 -04:00
parent 1e1617633c
commit 3ded0d4e77
2 changed files with 6 additions and 5 deletions

View file

@ -386,7 +386,6 @@ void database::process_budget()
- rec.from_accumulated_fees - rec.from_accumulated_fees
- rec.from_unused_witness_budget; - rec.from_unused_witness_budget;
share_type unused_prev_witness_budget = dpo.witness_budget;
modify(core, [&]( asset_dynamic_data_object& _core ) modify(core, [&]( asset_dynamic_data_object& _core )
{ {
_core.current_supply = (_core.current_supply + rec.supply_delta ); _core.current_supply = (_core.current_supply + rec.supply_delta );
@ -396,10 +395,11 @@ void database::process_budget()
+ worker_budget + worker_budget
- leftover_worker_funds - leftover_worker_funds
- _core.accumulated_fees - _core.accumulated_fees
- unused_prev_witness_budget - dpo.witness_budget
); );
_core.accumulated_fees = 0; _core.accumulated_fees = 0;
}); });
modify(dpo, [&]( dynamic_global_property_object& _dpo ) modify(dpo, [&]( dynamic_global_property_object& _dpo )
{ {
// Since initial witness_budget was rolled into // Since initial witness_budget was rolled into

View file

@ -80,14 +80,15 @@ void database::update_global_dynamic_data( const signed_block& b )
if( !(get_node_properties().skip_flags & skip_undo_history_check) ) if( !(get_node_properties().skip_flags & skip_undo_history_check) )
{ {
GRAPHENE_ASSERT( _dgp.recently_missed_count < GRAPHENE_MAX_UNDO_HISTORY, undo_database_exception, GRAPHENE_ASSERT( _dgp.head_block_number - _dgp.last_irreversible_block_num < GRAPHENE_MAX_UNDO_HISTORY, undo_database_exception,
"The database does not have enough undo history to support a blockchain with so many missed blocks. " "The database does not have enough undo history to support a blockchain with so many missed blocks. "
"Please add a checkpoint if you would like to continue applying blocks beyond this point.", "Please add a checkpoint if you would like to continue applying blocks beyond this point.",
("last_irreversible_block_num",_dgp.last_irreversible_block_num)("head", _dgp.head_block_number)
("recently_missed",_dgp.recently_missed_count)("max_undo",GRAPHENE_MAX_UNDO_HISTORY) ); ("recently_missed",_dgp.recently_missed_count)("max_undo",GRAPHENE_MAX_UNDO_HISTORY) );
} }
_undo_db.set_max_size( _dgp.recently_missed_count + GRAPHENE_MIN_UNDO_HISTORY ); _undo_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + GRAPHENE_MIN_UNDO_HISTORY );
_fork_db.set_max_size( _dgp.recently_missed_count + GRAPHENE_MIN_UNDO_HISTORY ); _fork_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + GRAPHENE_MIN_UNDO_HISTORY );
} }
void database::update_signing_witness(const witness_object& signing_witness, const signed_block& new_block) void database::update_signing_witness(const witness_object& signing_witness, const signed_block& new_block)