Skip to content

Commit

Permalink
Merge pull request #4617 from eval-exec/exec/early-return-init-load-u…
Browse files Browse the repository at this point in the history
…nverified

Early return init_load_unverified thread when no unverified blocks found after tip
  • Loading branch information
driftluo authored Aug 27, 2024
2 parents 7304ea7 + d28bde6 commit 3675433
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions chain/src/init_load_unverified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ impl InitLoadUnverified {
let unverified_hashes: Vec<packed::Byte32> =
self.find_unverified_block_hashes(check_unverified_number);

if check_unverified_number > tip_number && unverified_hashes.is_empty() {
info!(
"no unverified blocks found after tip, current tip: {}-{}",
tip_number,
self.shared.snapshot().tip_hash()
);
return;
}

for unverified_hash in unverified_hashes {
f(&unverified_hash);
}
Expand Down
5 changes: 5 additions & 0 deletions test/src/specs/sync/sync_churn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ impl Spec for SyncChurn {
if too_many_blocks || restart_stopped_rx.try_recv().is_ok() {
break;
}
info!(
"mining_node {}, tip: {}",
mining_node.node_id(),
mining_node.get_tip_block_number()
);
waiting_for_sync(&mining_nodes);
}
});
Expand Down

0 comments on commit 3675433

Please sign in to comment.