From 346e84ecbfc7debdd2e16c6c56456d0f59d53d87 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 10 Oct 2024 14:03:52 -0500 Subject: [PATCH] GH-284 Use scoped_set_value for replaying --- libraries/chain/controller.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index e4312e43c9..22a42a6f5d 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1701,8 +1701,6 @@ struct controller_impl { } void replay(startup_t startup) { - replaying = true; - bool replay_block_log_needed = should_replay_block_log(); auto blog_head = blog.head(); @@ -1840,8 +1838,6 @@ struct controller_impl { }; fork_db.apply(replay_fork_db); - replaying = false; - if( except_ptr ) { std::rethrow_exception( except_ptr ); } @@ -1990,6 +1986,7 @@ struct controller_impl { ilog( "chain database started with hash: ${hash}", ("hash", calculate_integrity_hash()) ); okay_to_print_integrity_hash_on_stop = true; + fc::scoped_set_value r(replaying, true); replay( startup ); // replay any irreversible and reversible blocks ahead of current head if( check_shutdown() ) return; @@ -4354,6 +4351,7 @@ struct controller_impl { } } + auto start = fc::time_point::now(); for( auto ritr = new_head_branch.rbegin(); ritr != new_head_branch.rend(); ++ritr ) { auto except = std::exception_ptr{}; const auto& bsp = *ritr;