@@ -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
@@ -619,24 +613,28 @@ 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
616
625
- CardanoTransactionsImporter :: new_for_test (
617
+ let ( importer, repository) = {
618
+ let connection = Arc :: new ( cardano_tx_db_connection ( ) . unwrap ( ) ) ;
619
+ let repository = Arc :: new ( CardanoTransactionRepository :: new ( connection. clone ( ) ) ) ;
620
+ let importer = CardanoTransactionsImporter :: new_for_test (
626
621
Arc :: new ( DumbBlockScanner :: new ( blocks. clone ( ) ) ) ,
627
- Arc :: new ( CardanoTransactionRepository :: new ( Arc :: new ( connection) ) ) ,
628
- )
622
+ Arc :: new ( CardanoTransactionRepository :: new ( connection. clone ( ) ) ) ,
623
+ ) ;
624
+ ( importer, repository)
629
625
} ;
630
626
631
- let cold_imported_transactions = importer
627
+ importer
632
628
. import ( 12 )
633
629
. await
634
630
. expect ( "Transactions Importer should succeed" ) ;
631
+ let cold_imported_transactions = repository. get_all ( ) . await . unwrap ( ) ;
635
632
636
- let warm_imported_transactions = importer
633
+ importer
637
634
. import ( 12 )
638
635
. await
639
636
. expect ( "Transactions Importer should succeed" ) ;
637
+ let warm_imported_transactions = repository. get_all ( ) . await . unwrap ( ) ;
640
638
641
639
assert_eq ! ( transactions, cold_imported_transactions) ;
642
640
assert_eq ! ( cold_imported_transactions, warm_imported_transactions) ;
0 commit comments