File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ pub(crate) async fn reconcile_batch<L2P: Provider<Scroll>>(
3939 // The block matches the derived attributes and the block is below or equal to the
4040 // safe current safe head.
4141 if attributes. block_number <= fcs. finalized_block_info ( ) . number ||
42- attributes. block_number <= fcs. safe_block_info ( ) . number
42+ ( ( attributes. block_number <= fcs. safe_block_info ( ) . number ) &&
43+ batch. target_status . is_consolidated ( ) )
4344 {
4445 Ok :: < _ , ChainOrchestratorError > ( BlockConsolidationAction :: Skip ( block_info) )
4546 } else {
Original file line number Diff line number Diff line change @@ -48,10 +48,16 @@ impl ForkchoiceState {
4848 pub async fn from_provider < P : Provider < Scroll > > ( provider : & P ) -> Option < Self > {
4949 let latest_block =
5050 provider. get_block ( BlockId :: Number ( BlockNumberOrTag :: Latest ) ) . await . ok ( ) ??;
51- let safe_block =
51+ let mut safe_block =
5252 provider. get_block ( BlockId :: Number ( BlockNumberOrTag :: Safe ) ) . await . ok ( ) ??;
5353 let finalized_block =
5454 provider. get_block ( BlockId :: Number ( BlockNumberOrTag :: Finalized ) ) . await . ok ( ) ??;
55+
56+ // Ensure safe is at least finalized.
57+ if safe_block. header . number < finalized_block. header . number {
58+ safe_block = finalized_block. clone ( ) ;
59+ }
60+
5561 Some ( Self {
5662 head : BlockInfo { number : latest_block. header . number , hash : latest_block. header . hash } ,
5763 safe : BlockInfo { number : safe_block. header . number , hash : safe_block. header . hash } ,
Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ pub enum BatchStatus {
7979}
8080
8181impl BatchStatus {
82+ /// Returns true if the batch status is consolidated.
83+ pub const fn is_consolidated ( & self ) -> bool {
84+ matches ! ( self , Self :: Consolidated )
85+ }
86+
8287 /// Returns true if the batch status is finalized.
8388 pub const fn is_finalized ( & self ) -> bool {
8489 matches ! ( self , Self :: Finalized )
You can’t perform that action at this time.
0 commit comments