File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
mithril-aggregator/src/services Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -564,6 +564,38 @@ mod tests {
564
564
) ;
565
565
}
566
566
567
+ #[ tokio:: test]
568
+ async fn can_compute_block_ranges_up_to_the_strict_end_of_a_block_range ( ) {
569
+ let connection = cardano_tx_db_connection ( ) . unwrap ( ) ;
570
+ let repository = Arc :: new ( CardanoTransactionRepository :: new ( Arc :: new (
571
+ SqliteConnectionPool :: build_from_connection ( connection) ,
572
+ ) ) ) ;
573
+
574
+ // Transactions for all blocks in the (15..=29) interval
575
+ let blocks = build_blocks ( BlockRange :: LENGTH , BlockRange :: LENGTH - 1 ) ;
576
+ let transactions = into_transactions ( & blocks) ;
577
+ repository. store_transactions ( transactions) . await . unwrap ( ) ;
578
+
579
+ let importer = CardanoTransactionsImporter :: new_for_test (
580
+ Arc :: new ( MockBlockScannerImpl :: new ( ) ) ,
581
+ repository. clone ( ) ,
582
+ ) ;
583
+
584
+ importer
585
+ . import_block_ranges ( BlockRange :: LENGTH * 2 - 1 )
586
+ . await
587
+ . expect ( "Transactions Importer should succeed" ) ;
588
+
589
+ let block_range_roots = repository. get_all_block_range_root ( ) . unwrap ( ) ;
590
+ assert_eq ! (
591
+ vec![ BlockRange :: from_block_number( BlockRange :: LENGTH ) ] ,
592
+ block_range_roots
593
+ . into_iter( )
594
+ . map( |r| r. range)
595
+ . collect:: <Vec <_>>( )
596
+ ) ;
597
+ }
598
+
567
599
#[ tokio:: test]
568
600
async fn can_compute_block_ranges_even_if_last_blocks_in_range_dont_have_transactions ( ) {
569
601
let connection = cardano_tx_db_connection ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments