diff --git a/crates/chain-orchestrator/src/status.rs b/crates/chain-orchestrator/src/status.rs index 26351f21..128e7c59 100644 --- a/crates/chain-orchestrator/src/status.rs +++ b/crates/chain-orchestrator/src/status.rs @@ -11,6 +11,13 @@ pub struct ChainOrchestratorStatus { pub l2: L2ChainStatus, } +impl ChainOrchestratorStatus { + /// Returns true if the chain orchestrator is fully synced. + pub const fn is_synced(&self) -> bool { + self.l1.status.is_synced() && self.l2.status.is_synced() + } +} + impl ChainOrchestratorStatus { /// Creates a new [`ChainOrchestratorStatus`] from the given sync state, latest L1 block number, pub fn new( diff --git a/crates/node/src/add_ons/remote_block_source.rs b/crates/node/src/add_ons/remote_block_source.rs index 876c974f..595beb1e 100644 --- a/crates/node/src/add_ons/remote_block_source.rs +++ b/crates/node/src/add_ons/remote_block_source.rs @@ -195,6 +195,11 @@ where continue; } + if !self.orchestrator_handle.status().await?.is_synced() { + tracing::debug!(target: "scroll::remote_source", "Imported block is valid, but orchestrator is not synced, skipping build"); + continue; + } + // Trigger block building on top of the imported block self.orchestrator_handle.build_block();