File tree Expand file tree Collapse file tree
crates/chain-orchestrator/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1166,14 +1166,12 @@ impl<
11661166 }
11671167
11681168 // Update the FCS to the new head.
1169- let result = self
1170- . engine
1171- . update_fcs (
1172- Some ( BlockInfo { number : chain_head_number, hash : chain_head_hash } ) ,
1173- None ,
1174- None ,
1175- )
1176- . await ?;
1169+ let head = BlockInfo { number : chain_head_number, hash : chain_head_hash } ;
1170+ let result = if self . sync_state . l2 ( ) . is_syncing ( ) {
1171+ self . engine . optimistic_sync ( head) . await ?
1172+ } else {
1173+ self . engine . update_fcs ( Some ( head) , None , None ) . await ?
1174+ } ;
11771175
11781176 // If the FCS update resulted in an invalid state, we return an error.
11791177 if result. is_invalid ( ) {
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ impl SyncState {
3939 pub const fn is_synced ( & self ) -> bool {
4040 self . l1 . is_synced ( ) && self . l2 . is_synced ( )
4141 }
42+
43+ /// Returns true if either L1 or L2 is syncing.
44+ pub const fn is_syncing ( & self ) -> bool {
45+ self . l1 . is_syncing ( ) || self . l2 . is_syncing ( )
46+ }
4247}
4348
4449/// The sync mode of the chain orchestrator.
You can’t perform that action at this time.
0 commit comments