@@ -174,15 +174,9 @@ impl CardanoTransactionsImporter {
174
174
175
175
#[ async_trait]
176
176
impl TransactionsImporter for CardanoTransactionsImporter {
177
- async fn import (
178
- & self ,
179
- up_to_beacon : ImmutableFileNumber ,
180
- ) -> StdResult < Vec < CardanoTransaction > > {
177
+ async fn import ( & self , up_to_beacon : ImmutableFileNumber ) -> StdResult < ( ) > {
181
178
self . import_transactions ( up_to_beacon) . await ?;
182
- self . import_block_ranges ( ) . await ?;
183
-
184
- let transactions = self . transaction_store . get_up_to ( up_to_beacon) . await ?;
185
- Ok ( transactions)
179
+ self . import_block_ranges ( ) . await
186
180
}
187
181
}
188
182
@@ -288,7 +282,7 @@ mod tests {
288
282
. await
289
283
. expect ( "Transactions Importer should succeed" ) ;
290
284
291
- let stored_transactions = repository. get_up_to ( 10000 ) . await . unwrap ( ) ;
285
+ let stored_transactions = repository. get_all ( ) . await . unwrap ( ) ;
292
286
assert_eq ! ( expected_transactions, stored_transactions) ;
293
287
}
294
288
@@ -410,7 +404,7 @@ mod tests {
410
404
. await
411
405
. expect ( "Transactions Importer should succeed" ) ;
412
406
413
- let transactions = repository. get_up_to ( 10000 ) . await . unwrap ( ) ;
407
+ let transactions = repository. get_all ( ) . await . unwrap ( ) ;
414
408
assert_eq ! ( vec![ last_tx] , transactions) ;
415
409
}
416
410
@@ -448,15 +442,15 @@ mod tests {
448
442
CardanoTransactionsImporter :: new_for_test ( Arc :: new ( scanner_mock) , repository. clone ( ) )
449
443
} ;
450
444
451
- let stored_transactions = repository. get_up_to ( 10000 ) . await . unwrap ( ) ;
445
+ let stored_transactions = repository. get_all ( ) . await . unwrap ( ) ;
452
446
assert_eq ! ( stored_block. into_transactions( ) , stored_transactions) ;
453
447
454
448
importer
455
449
. import_transactions ( up_to_beacon)
456
450
. await
457
451
. expect ( "Transactions Importer should succeed" ) ;
458
452
459
- let stored_transactions = repository. get_up_to ( 10000 ) . await . unwrap ( ) ;
453
+ let stored_transactions = repository. get_all ( ) . await . unwrap ( ) ;
460
454
assert_eq ! ( expected_transactions, stored_transactions) ;
461
455
}
462
456
@@ -619,24 +613,27 @@ mod tests {
619
613
ScannedBlock :: new( "block_hash-2" , 20 , 25 , 12 , vec![ "tx_hash-3" , "tx_hash-4" ] ) ,
620
614
] ;
621
615
let transactions = into_transactions ( & blocks) ;
622
- let importer = {
623
- let connection = cardano_tx_db_connection ( ) . unwrap ( ) ;
624
-
625
- CardanoTransactionsImporter :: new_for_test (
616
+ let ( importer, repository ) = {
617
+ let connection = Arc :: new ( cardano_tx_db_connection ( ) . unwrap ( ) ) ;
618
+ let repository = Arc :: new ( CardanoTransactionRepository :: new ( connection . clone ( ) ) ) ;
619
+ let importer = CardanoTransactionsImporter :: new_for_test (
626
620
Arc :: new ( DumbBlockScanner :: new ( blocks. clone ( ) ) ) ,
627
- Arc :: new ( CardanoTransactionRepository :: new ( Arc :: new ( connection) ) ) ,
628
- )
621
+ Arc :: new ( CardanoTransactionRepository :: new ( connection. clone ( ) ) ) ,
622
+ ) ;
623
+ ( importer, repository)
629
624
} ;
630
625
631
- let cold_imported_transactions = importer
626
+ importer
632
627
. import ( 12 )
633
628
. await
634
629
. expect ( "Transactions Importer should succeed" ) ;
630
+ let cold_imported_transactions = repository. get_all ( ) . await . unwrap ( ) ;
635
631
636
- let warm_imported_transactions = importer
632
+ importer
637
633
. import ( 12 )
638
634
. await
639
635
. expect ( "Transactions Importer should succeed" ) ;
636
+ let warm_imported_transactions = repository. get_all ( ) . await . unwrap ( ) ;
640
637
641
638
assert_eq ! ( transactions, cold_imported_transactions) ;
642
639
assert_eq ! ( cold_imported_transactions, warm_imported_transactions) ;
0 commit comments