Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions crates/chain-orchestrator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,14 +1166,12 @@ impl<
}

// Update the FCS to the new head.
let result = self
.engine
.update_fcs(
Some(BlockInfo { number: chain_head_number, hash: chain_head_hash }),
None,
None,
)
.await?;
let head = BlockInfo { number: chain_head_number, hash: chain_head_hash };
let result = if self.sync_state.l2().is_syncing() {
self.engine.optimistic_sync(head).await?
} else {
self.engine.update_fcs(Some(head), None, None).await?
};

// If the FCS update resulted in an invalid state, we return an error.
if result.is_invalid() {
Expand Down
5 changes: 5 additions & 0 deletions crates/chain-orchestrator/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ impl SyncState {
pub const fn is_synced(&self) -> bool {
self.l1.is_synced() && self.l2.is_synced()
}

/// Returns true if either L1 or L2 is syncing.
pub const fn is_syncing(&self) -> bool {
self.l1.is_syncing() || self.l2.is_syncing()
}
}

/// The sync mode of the chain orchestrator.
Expand Down
Loading