Skip to content

Commit

Permalink
Merge pull request #1028 from AntelopeIO/GH-1002-log-failed
Browse files Browse the repository at this point in the history
Fix start_block to return correct return code for incomplete apply_block
  • Loading branch information
heifner authored Nov 14, 2024
2 parents 22a6dde + f20739e commit be54b82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4453,7 +4453,8 @@ struct controller_impl {
}
// Break every ~500ms to allow other tasks (e.g. get_info, SHiP) opportunity to run. User expected
// to call apply_blocks again if this returns incomplete.
if (!replaying && fc::time_point::now() - start_apply_blocks_loop > fc::milliseconds(500)) {
const bool more_blocks_to_process = ritr + 1 != new_head_branch.rend();
if (!replaying && more_blocks_to_process && fc::time_point::now() - start_apply_blocks_loop > fc::milliseconds(500)) {
result = controller::apply_blocks_result::incomplete;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block() {
auto r = chain.apply_blocks([this](const transaction_metadata_ptr& trx) { _unapplied_transactions.add_forked(trx); },
[this](const transaction_id_type& id) { return _unapplied_transactions.get_trx(id); });
if (r != controller::apply_blocks_result::complete)
return start_block_result::failed;
return start_block_result::waiting_for_block;

if (chain.should_terminate()) {
app().quit();
Expand Down

0 comments on commit be54b82

Please sign in to comment.