Skip to content

Commit 7f517db

Browse files
authored
ensure node is synced before trying to build a block (#492)
1 parent 32fc9ee commit 7f517db

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

crates/chain-orchestrator/src/status.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ pub struct ChainOrchestratorStatus {
1111
pub l2: L2ChainStatus,
1212
}
1313

14+
impl ChainOrchestratorStatus {
15+
/// Returns true if the chain orchestrator is fully synced.
16+
pub const fn is_synced(&self) -> bool {
17+
self.l1.status.is_synced() && self.l2.status.is_synced()
18+
}
19+
}
20+
1421
impl ChainOrchestratorStatus {
1522
/// Creates a new [`ChainOrchestratorStatus`] from the given sync state, latest L1 block number,
1623
pub fn new(

crates/node/src/add_ons/remote_block_source.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ where
195195
continue;
196196
}
197197

198+
if !self.orchestrator_handle.status().await?.is_synced() {
199+
tracing::debug!(target: "scroll::remote_source", "Imported block is valid, but orchestrator is not synced, skipping build");
200+
continue;
201+
}
202+
198203
// Trigger block building on top of the imported block
199204
self.orchestrator_handle.build_block();
200205

0 commit comments

Comments
 (0)