Skip to content

Commit

Permalink
GH-1082 Must break after completion of making block irreversible
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Dec 20, 2024
1 parent 2c0ca2e commit a19ff61
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1584,12 +1584,6 @@ struct controller_impl {
result = apply_irreversible_block(fork_db, *bitr);
if (result != controller::apply_blocks_result::complete)
break;
// In irreversible mode, break every ~500ms to allow other tasks (e.g. get_info, SHiP) opportunity to run
const bool more_blocks_to_process = bitr + 1 != branch.rend();
if (!replaying && more_blocks_to_process && fc::time_point::now() - start > fc::milliseconds(500)) {
result = controller::apply_blocks_result::incomplete;
break;
}
}

emit( irreversible_block, std::tie((*bitr)->block, (*bitr)->id()), __FILE__, __LINE__ );
Expand All @@ -1605,6 +1599,14 @@ struct controller_impl {
fork_db_.switch_to(fork_database::in_use_t::savanna);
break;
}
if (irreversible_mode()) {
// In irreversible mode, break every ~500ms to allow other tasks (e.g. get_info, SHiP) opportunity to run
const bool more_blocks_to_process = bitr + 1 != branch.rend();
if (!replaying && more_blocks_to_process && fc::time_point::now() - start > fc::milliseconds(500)) {
result = controller::apply_blocks_result::incomplete;
break;
}
}
}
} FC_CAPTURE_AND_RETHROW() } catch ( const fc::exception& e ) {
try {
Expand Down

0 comments on commit a19ff61

Please sign in to comment.