Skip to content

Commit 3675433

Browse files
authored
Merge pull request #4617 from eval-exec/exec/early-return-init-load-unverified
Early return init_load_unverified thread when no unverified blocks found after tip
2 parents 7304ea7 + d28bde6 commit 3675433

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

chain/src/init_load_unverified.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ impl InitLoadUnverified {
9393
let unverified_hashes: Vec<packed::Byte32> =
9494
self.find_unverified_block_hashes(check_unverified_number);
9595

96+
if check_unverified_number > tip_number && unverified_hashes.is_empty() {
97+
info!(
98+
"no unverified blocks found after tip, current tip: {}-{}",
99+
tip_number,
100+
self.shared.snapshot().tip_hash()
101+
);
102+
return;
103+
}
104+
96105
for unverified_hash in unverified_hashes {
97106
f(&unverified_hash);
98107
}

test/src/specs/sync/sync_churn.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ impl Spec for SyncChurn {
6060
if too_many_blocks || restart_stopped_rx.try_recv().is_ok() {
6161
break;
6262
}
63+
info!(
64+
"mining_node {}, tip: {}",
65+
mining_node.node_id(),
66+
mining_node.get_tip_block_number()
67+
);
6368
waiting_for_sync(&mining_nodes);
6469
}
6570
});

0 commit comments

Comments
 (0)