Skip to content

Commit a19ff61

Browse files
committed
GH-1082 Must break after completion of making block irreversible
1 parent 2c0ca2e commit a19ff61

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

libraries/chain/controller.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,12 +1584,6 @@ struct controller_impl {
15841584
result = apply_irreversible_block(fork_db, *bitr);
15851585
if (result != controller::apply_blocks_result::complete)
15861586
break;
1587-
// In irreversible mode, break every ~500ms to allow other tasks (e.g. get_info, SHiP) opportunity to run
1588-
const bool more_blocks_to_process = bitr + 1 != branch.rend();
1589-
if (!replaying && more_blocks_to_process && fc::time_point::now() - start > fc::milliseconds(500)) {
1590-
result = controller::apply_blocks_result::incomplete;
1591-
break;
1592-
}
15931587
}
15941588

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

0 commit comments

Comments
 (0)