1
1
use std:: mem;
2
2
use std:: ops:: Range ;
3
- use std:: path:: { Path , PathBuf } ;
4
3
use std:: sync:: Arc ;
5
4
6
5
use anyhow:: Context ;
@@ -57,7 +56,6 @@ pub struct CardanoTransactionsImporter {
57
56
block_scanner : Arc < dyn BlockScanner > ,
58
57
transaction_store : Arc < dyn TransactionStore > ,
59
58
logger : Logger ,
60
- dirpath : PathBuf ,
61
59
}
62
60
63
61
impl CardanoTransactionsImporter {
@@ -69,14 +67,12 @@ impl CardanoTransactionsImporter {
69
67
pub fn new (
70
68
block_scanner : Arc < dyn BlockScanner > ,
71
69
transaction_store : Arc < dyn TransactionStore > ,
72
- dirpath : & Path ,
73
70
logger : Logger ,
74
71
) -> Self {
75
72
Self {
76
73
block_scanner,
77
74
transaction_store,
78
75
logger,
79
- dirpath : dirpath. to_owned ( ) ,
80
76
}
81
77
}
82
78
@@ -104,7 +100,7 @@ impl CardanoTransactionsImporter {
104
100
from. as_ref( ) . map( |c|c. block_number) . unwrap_or( 0 )
105
101
) ;
106
102
107
- let mut streamer = self . block_scanner . scan ( & self . dirpath , from, until) . await ?;
103
+ let mut streamer = self . block_scanner . scan ( from, until) . await ?;
108
104
109
105
while let Some ( blocks) = streamer. poll_next ( ) . await ? {
110
106
match blocks {
@@ -221,7 +217,6 @@ mod tests {
221
217
impl BlockScanner for BlockScannerImpl {
222
218
async fn scan(
223
219
& self ,
224
- dirpath: & Path ,
225
220
from: Option <ChainPoint >,
226
221
until: BlockNumber ,
227
222
) -> StdResult <Box <dyn BlockStreamer >>;
@@ -233,12 +228,7 @@ mod tests {
233
228
scanner : Arc < dyn BlockScanner > ,
234
229
transaction_store : Arc < dyn TransactionStore > ,
235
230
) -> Self {
236
- CardanoTransactionsImporter :: new (
237
- scanner,
238
- transaction_store,
239
- Path :: new ( "" ) ,
240
- TestLogger :: stdout ( ) ,
241
- )
231
+ CardanoTransactionsImporter :: new ( scanner, transaction_store, TestLogger :: stdout ( ) )
242
232
}
243
233
}
244
234
@@ -292,8 +282,8 @@ mod tests {
292
282
let mut scanner_mock = MockBlockScannerImpl :: new ( ) ;
293
283
scanner_mock
294
284
. expect_scan ( )
295
- . withf ( move |_ , from, until| from. is_none ( ) && until == & up_to_block_number)
296
- . return_once ( move |_, _, _ | {
285
+ . withf ( move |from, until| from. is_none ( ) && until == & up_to_block_number)
286
+ . return_once ( move |_, _| {
297
287
Ok ( Box :: new ( DumbBlockStreamer :: new ( ) . forwards ( vec ! [ blocks] ) ) )
298
288
} ) ;
299
289
CardanoTransactionsImporter :: new_for_test ( Arc :: new ( scanner_mock) , repository. clone ( ) )
@@ -474,11 +464,11 @@ mod tests {
474
464
let mut scanner_mock = MockBlockScannerImpl :: new ( ) ;
475
465
scanner_mock
476
466
. expect_scan ( )
477
- . withf ( move |_ , from, until| {
467
+ . withf ( move |from, until| {
478
468
from == & Some ( highest_stored_chain_point. clone ( ) )
479
469
&& * until == up_to_block_number
480
470
} )
481
- . return_once ( move |_, _, _ | {
471
+ . return_once ( move |_, _| {
482
472
Ok ( Box :: new (
483
473
DumbBlockStreamer :: new ( ) . forwards ( vec ! [ scanned_blocks] ) ,
484
474
) )
0 commit comments