Skip to content

Commit

Permalink
GH-579 Update max-reversible-blocks to work with savanna blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Aug 19, 2024
1 parent 89dba19 commit 1d200e1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,13 @@ struct controller_impl {
return prev->block_num();
}

// returns 0 for legacy
size_t fork_db_savanna_size() const {
return fork_db.apply_s<size_t>([&](const auto& forkdb) {
return forkdb.size();
});
}

bool fork_db_block_exists( const block_id_type& id ) const {
return fork_db.apply<bool>([&](const auto& forkdb) {
return forkdb.block_exists(id);
Expand Down Expand Up @@ -4793,9 +4800,9 @@ struct controller_impl {
("n", reversible_block_num)("num", conf.terminate_at_block) );
return true;
}
if (conf.max_reversible_blocks > 0 && fork_db.size() >= conf.max_reversible_blocks) {
if (conf.max_reversible_blocks > 0 && fork_db_savanna_size() >= conf.max_reversible_blocks) {
elog("Exceeded max reversible blocks allowed, fork db size ${s} >= max-reversible-blocks ${m}",
("s", fork_db.size())("m", conf.max_reversible_blocks));
("s", fork_db_savanna_size())("m", conf.max_reversible_blocks));
return true;
}
return false;
Expand Down

0 comments on commit 1d200e1

Please sign in to comment.