@@ -413,11 +413,12 @@ impl DatabaseReadOperations for Database {
413413 async fn get_batch_by_index (
414414 & self ,
415415 batch_index : u64 ,
416+ processed : Option < bool > ,
416417 ) -> Result < Option < BatchCommitData > , DatabaseError > {
417418 metered ! (
418419 DatabaseOperation :: GetBatchByIndex ,
419420 self ,
420- tx( move |tx| async move { tx. get_batch_by_index( batch_index) . await } )
421+ tx( move |tx| async move { tx. get_batch_by_index( batch_index, processed ) . await } )
421422 )
422423 }
423424
@@ -735,7 +736,7 @@ mod test {
735736 // Round trip the BatchCommitData through the database.
736737 db. insert_batch ( batch_commit. clone ( ) ) . await . unwrap ( ) ;
737738 let batch_commit_from_db =
738- db. get_batch_by_index ( batch_commit. index ) . await . unwrap ( ) . unwrap ( ) ;
739+ db. get_batch_by_index ( batch_commit. index , None ) . await . unwrap ( ) . unwrap ( ) ;
739740
740741 assert_eq ! ( batch_commit, batch_commit_from_db) ;
741742 }
@@ -1249,7 +1250,7 @@ mod test {
12491250
12501251 // Insert L2 blocks with different batch indices
12511252 for i in 100 ..110 {
1252- let batch_data = db. get_batch_by_index ( i) . await . unwrap ( ) . unwrap ( ) ;
1253+ let batch_data = db. get_batch_by_index ( i, None ) . await . unwrap ( ) . unwrap ( ) ;
12531254 let batch_info: BatchInfo = batch_data. into ( ) ;
12541255 let block_info = BlockInfo { number : 500 + i, hash : B256 :: arbitrary ( & mut u) . unwrap ( ) } ;
12551256
@@ -1418,9 +1419,9 @@ mod test {
14181419 db. set_finalized_l1_block_number ( 21 ) . await . unwrap ( ) ;
14191420
14201421 // Verify the batches and blocks were inserted correctly
1421- let retrieved_batch_1 = db. get_batch_by_index ( 1 ) . await . unwrap ( ) . unwrap ( ) ;
1422- let retrieved_batch_2 = db. get_batch_by_index ( 2 ) . await . unwrap ( ) . unwrap ( ) ;
1423- let retrieved_batch_3 = db. get_batch_by_index ( 3 ) . await . unwrap ( ) . unwrap ( ) ;
1422+ let retrieved_batch_1 = db. get_batch_by_index ( 1 , None ) . await . unwrap ( ) . unwrap ( ) ;
1423+ let retrieved_batch_2 = db. get_batch_by_index ( 2 , None ) . await . unwrap ( ) . unwrap ( ) ;
1424+ let retrieved_batch_3 = db. get_batch_by_index ( 3 , None ) . await . unwrap ( ) . unwrap ( ) ;
14241425 let retried_block_1 = db. get_l2_block_info_by_number ( 1 ) . await . unwrap ( ) . unwrap ( ) ;
14251426 let retried_block_2 = db. get_l2_block_info_by_number ( 2 ) . await . unwrap ( ) . unwrap ( ) ;
14261427 let retried_block_3 = db. get_l2_block_info_by_number ( 3 ) . await . unwrap ( ) . unwrap ( ) ;
@@ -1441,9 +1442,9 @@ mod test {
14411442 assert_eq ! ( result, ( Some ( block_2) , Some ( 11 ) ) ) ;
14421443
14431444 // Verify that batches 2 and 3 are deleted
1444- let batch_1 = db. get_batch_by_index ( 1 ) . await . unwrap ( ) ;
1445- let batch_2 = db. get_batch_by_index ( 2 ) . await . unwrap ( ) ;
1446- let batch_3 = db. get_batch_by_index ( 3 ) . await . unwrap ( ) ;
1445+ let batch_1 = db. get_batch_by_index ( 1 , None ) . await . unwrap ( ) ;
1446+ let batch_2 = db. get_batch_by_index ( 2 , None ) . await . unwrap ( ) ;
1447+ let batch_3 = db. get_batch_by_index ( 3 , None ) . await . unwrap ( ) ;
14471448 assert ! ( batch_1. is_some( ) ) ;
14481449 assert ! ( batch_2. is_none( ) ) ;
14491450 assert ! ( batch_3. is_none( ) ) ;
0 commit comments