Skip to content

Commit

Permalink
adjust undo buffer based upon last_irreversible_block_num
Browse files Browse the repository at this point in the history
  • Loading branch information
bytemaster committed Oct 5, 2015
1 parent 1e16176 commit 3ded0d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libraries/chain/db_maint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ void database::process_budget()
- rec.from_accumulated_fees
- rec.from_unused_witness_budget;

share_type unused_prev_witness_budget = dpo.witness_budget;
modify(core, [&]( asset_dynamic_data_object& _core )
{
_core.current_supply = (_core.current_supply + rec.supply_delta );
Expand All @@ -396,10 +395,11 @@ void database::process_budget()
+ worker_budget
- leftover_worker_funds
- _core.accumulated_fees
- unused_prev_witness_budget
- dpo.witness_budget
);
_core.accumulated_fees = 0;
});

modify(dpo, [&]( dynamic_global_property_object& _dpo )
{
// Since initial witness_budget was rolled into
Expand Down
7 changes: 4 additions & 3 deletions libraries/chain/db_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ void database::update_global_dynamic_data( const signed_block& b )

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. "
"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) );
}

_undo_db.set_max_size( _dgp.recently_missed_count + GRAPHENE_MIN_UNDO_HISTORY );
_fork_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.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)
Expand Down

0 comments on commit 3ded0d4

Please sign in to comment.