Skip to content

Commit

Permalink
GH-284 Use scoped_set_value for replaying
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Oct 10, 2024
1 parent b565770 commit 346e84e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1840,8 +1838,6 @@ struct controller_impl {
};
fork_db.apply<void>(replay_fork_db);

replaying = false;

if( except_ptr ) {
std::rethrow_exception( except_ptr );
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 346e84e

Please sign in to comment.