@@ -275,13 +275,6 @@ impl<
275275 optimistic_headers. push_front ( header) ;
276276 }
277277
278- // Persist the head block to the database.
279- persist_l2_head_with_retry (
280- database. clone ( ) ,
281- optimistic_headers. last ( ) . expect ( "chain can not be empty" ) . into ( ) ,
282- )
283- . await ?;
284-
285278 * chain. lock ( ) . await = optimistic_headers;
286279 * optimistic_mode. lock ( ) . await = true ;
287280 return Ok ( ChainOrchestratorEvent :: OptimisticSync ( received_block) ) ;
@@ -447,13 +440,6 @@ impl<
447440 validate_l1_messages ( & new_blocks, & database) . await ?;
448441 }
449442
450- // Persist the head block to the database.
451- persist_l2_head_with_retry (
452- database. clone ( ) ,
453- new_blocks. last ( ) . expect ( "chain can not be empty" ) . into ( ) ,
454- )
455- . await ?;
456-
457443 match reorg_index {
458444 // If this is a simple chain extension, we can just extend the in-memory chain and emit
459445 // a ChainExtended event.
@@ -550,6 +536,7 @@ impl<
550536 . retry ( "update_l1_messages_from_l2_blocks" , || async {
551537 let tx = database. tx_mut ( ) . await ?;
552538 tx. update_l1_messages_from_l2_blocks ( block_info. clone ( ) ) . await ?;
539+ tx. set_l2_head_block_info ( head. block_info ) . await ?;
553540 tx. commit ( ) . await ?;
554541 Ok :: < _ , ChainOrchestratorError > ( ( ) )
555542 } )
@@ -900,21 +887,6 @@ async fn init_chain_from_db<P: Provider<Scroll> + 'static>(
900887 Ok ( chain)
901888}
902889
903- /// Persists the L2 head block info with retries.
904- async fn persist_l2_head_with_retry (
905- db : Arc < Database > ,
906- block : BlockInfo ,
907- ) -> Result < ( ) , ChainOrchestratorError > {
908- Retry :: default ( )
909- . retry ( "set_l2_head_block_info" , || async {
910- let tx = db. tx_mut ( ) . await ?;
911- tx. set_l2_head_block_info ( block) . await ?;
912- tx. commit ( ) . await ?;
913- Ok :: < _ , ChainOrchestratorError > ( ( ) )
914- } )
915- . await
916- }
917-
918890impl <
919891 ChainSpec : ScrollHardforks + ' static ,
920892 BC : BlockClient < Block = ScrollBlock > + Send + Sync + ' static ,
0 commit comments