Skip to content

Commit

Permalink
GH-2102 Check for terminate_at_block during apply of fork db blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Apr 4, 2024
1 parent b9deb58 commit 8a7b973
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4007,6 +4007,12 @@ struct controller_impl {
br = controller::block_report{};
apply_block( br, *ritr, valid ? controller::block_status::validated
: controller::block_status::complete, trx_lookup );

if( conf.terminate_at_block > 0 && conf.terminate_at_block <= chain_head.block_num()) {
ilog("Reached configured maximum block ${num}; terminating", ("num", conf.terminate_at_block) );
shutdown();
return;
}
} catch ( const std::bad_alloc& ) {
throw;
} catch ( const boost::interprocess::bad_alloc& ) {
Expand Down

0 comments on commit 8a7b973

Please sign in to comment.