@@ -990,7 +990,7 @@ struct controller_impl {
990
990
// persist chain_head after vote_processor shutdown, avoids concurrent access, after chain_head & conf since this uses them
991
991
fc::scoped_exit<std::function<void ()>> write_chain_head = [&]() { chain_head.write (conf.state_dir / config::chain_head_filename); };
992
992
const chain_id_type chain_id; // read by thread_pool threads, value will not be changed
993
- bool replaying = false ;
993
+ std::atomic< bool > replaying = false ;
994
994
bool is_producer_node = false ; // true if node is configured as a block producer
995
995
block_num_type pause_at_block_num = std::numeric_limits<block_num_type>::max();
996
996
const db_read_mode read_mode;
@@ -1751,7 +1751,8 @@ struct controller_impl {
1751
1751
}
1752
1752
transition_legacy_branch.clear (); // not needed after replay
1753
1753
auto end = fc::time_point::now ();
1754
- ilog ( " ${n} irreversible blocks replayed from block log" , (" n" , 1 + chain_head.block_num () - start_block_num) );
1754
+ ilog ( " ${n} irreversible blocks replayed from block log, chain head ${bn}" ,
1755
+ (" n" , 1 + chain_head.block_num () - start_block_num)(" bn" , chain_head.block_num ()) );
1755
1756
ilog ( " replayed ${n} blocks in ${duration} seconds, ${mspb} ms/block" ,
1756
1757
(" n" , chain_head.block_num () + 1 - start_block_num)(" duration" , (end-start).count ()/1000000 )
1757
1758
(" mspb" , ((end-start).count ()/1000.0 )/(chain_head.block_num ()-start_block_num)) );
@@ -2050,7 +2051,8 @@ struct controller_impl {
2050
2051
ilog ( " chain database started with hash: ${hash}" , (" hash" , calculate_integrity_hash ()) );
2051
2052
okay_to_print_integrity_hash_on_stop = true ;
2052
2053
2053
- fc::scoped_set_value r (replaying, true );
2054
+ replaying = true ;
2055
+ auto replay_reset = fc::make_scoped_exit ([&](){ replaying = false ; });
2054
2056
replay ( startup ); // replay any irreversible and reversible blocks ahead of current head
2055
2057
2056
2058
if ( check_shutdown () ) return ;
@@ -4533,7 +4535,7 @@ struct controller_impl {
4533
4535
// Only interrupt transaction if applying a block. Speculative trxs already have a deadline set so they
4534
4536
// have limited run time already. This is to allow killing a long-running transaction in a block being
4535
4537
// validated.
4536
- if (applying_block) {
4538
+ if (!replaying && applying_block) {
4537
4539
ilog (" Interrupting apply block" );
4538
4540
main_thread_timer.interrupt_timer ();
4539
4541
}
0 commit comments