@@ -112,26 +112,31 @@ impl SnapshotConverterCommand {
112
112
distribution_dir. display( )
113
113
)
114
114
} ) ?;
115
-
116
115
let archive_path = Self :: download_cardano_node_distribution (
117
116
ReqwestGitHubApiClient :: new ( ) ?,
118
117
ReqwestHttpDownloader :: new ( ) ?,
119
118
& self . cardano_node_version ,
120
119
& distribution_dir,
121
120
)
122
121
. await
123
- . with_context ( || {
124
- "Failed to download 'snapshot-converter' binary from Cardano node distribution"
125
- } ) ?;
122
+ . with_context ( || "Failed to download Cardano node distribution" ) ?;
126
123
124
+ println ! (
125
+ "Unpacking distribution from archive: {}" ,
126
+ archive_path. display( )
127
+ ) ;
127
128
ArchiveUnpacker :: default ( )
128
129
. unpack ( & archive_path, & distribution_dir)
129
130
. with_context ( || {
130
131
format ! (
131
- "Failed to unpack 'snapshot-converter' binary to directory: {}" ,
132
+ "Failed to unpack distribution to directory: {}" ,
132
133
distribution_dir. display( )
133
134
)
134
135
} ) ?;
136
+ println ! (
137
+ "Distribution unpacked successfully to: {}" ,
138
+ distribution_dir. display( )
139
+ ) ;
135
140
136
141
Self :: convert_ledger_state_snapshot (
137
142
& work_dir,
@@ -186,7 +191,6 @@ impl SnapshotConverterCommand {
186
191
. await
187
192
. with_context ( || format ! ( "Failed to get release by tag: {}" , tag) ) ?,
188
193
} ;
189
-
190
194
let asset = release
191
195
. get_asset_for_os ( env:: consts:: OS ) ?
192
196
. ok_or_else ( || anyhow ! ( "No asset found for platform: {}" , env:: consts:: OS ) )
@@ -196,7 +200,6 @@ impl SnapshotConverterCommand {
196
200
env:: consts:: OS
197
201
)
198
202
} ) ?;
199
-
200
203
let archive_path = http_downloader
201
204
. download_file ( asset. browser_download_url . parse ( ) ?, target_dir, & asset. name )
202
205
. await ?;
@@ -229,7 +232,6 @@ impl SnapshotConverterCommand {
229
232
& copied_snapshot_path,
230
233
utxo_hd_flavor,
231
234
) ?;
232
-
233
235
let converter_bin =
234
236
Self :: get_snapshot_converter_binary_path ( distribution_dir, env:: consts:: OS ) ?;
235
237
let config_path =
@@ -284,7 +286,6 @@ impl SnapshotConverterCommand {
284
286
target_os : & str ,
285
287
) -> MithrilResult < PathBuf > {
286
288
let base_path = distribution_dir. join ( SNAPSHOT_CONVERTER_BIN_DIR ) ;
287
-
288
289
let binary_name = match target_os {
289
290
"linux" | "macos" => SNAPSHOT_CONVERTER_BIN_NAME_UNIX ,
290
291
"windows" => SNAPSHOT_CONVERTER_BIN_NAME_WINDOWS ,
@@ -307,19 +308,16 @@ impl SnapshotConverterCommand {
307
308
/// Finds the oldest ledger snapshot (by slot number) in the `ledger/` directory of a Cardano node database.
308
309
fn find_oldest_ledger_state_snapshot ( db_dir : & Path ) -> MithrilResult < PathBuf > {
309
310
let ledger_dir = db_dir. join ( LEDGER_DIR ) ;
310
-
311
311
let entries = read_dir ( & ledger_dir) . with_context ( || {
312
312
format ! (
313
313
"Failed to read ledger state snapshots directory: {}" ,
314
314
ledger_dir. display( )
315
315
)
316
316
} ) ?;
317
-
318
317
let mut min_slot: Option < ( u64 , PathBuf ) > = None ;
319
318
320
319
for entry in entries {
321
320
let entry = entry?;
322
-
323
321
let slot = match Self :: extract_slot_number ( & entry. path ( ) ) {
324
322
Ok ( number) => number,
325
323
Err ( _) => continue ,
@@ -365,7 +363,6 @@ impl SnapshotConverterCommand {
365
363
input_snapshot. display( )
366
364
)
367
365
} ) ?;
368
-
369
366
let converted_snapshot_path = snapshots_dir. join ( format ! (
370
367
"{}_{}" ,
371
368
slot_number,
@@ -379,7 +376,6 @@ impl SnapshotConverterCommand {
379
376
let file_name = path
380
377
. file_name ( )
381
378
. ok_or_else ( || anyhow ! ( "No filename in path: {}" , path. display( ) ) ) ?;
382
-
383
379
let file_name_str = file_name
384
380
. to_str ( )
385
381
. ok_or_else ( || anyhow ! ( "Invalid UTF-8 in path filename: {:?}" , file_name) ) ?;
@@ -400,30 +396,25 @@ impl SnapshotConverterCommand {
400
396
ledger_dir. display( ) ,
401
397
converted_snapshot_path. display( )
402
398
) ;
403
-
404
399
let filename = converted_snapshot_path
405
400
. file_name ( )
406
401
. ok_or_else ( || anyhow ! ( "Missing filename in converted snapshot path" ) ) ?
407
402
. to_string_lossy ( ) ;
408
-
409
403
let ( slot_number, _) = filename
410
404
. split_once ( '_' )
411
405
. ok_or_else ( || anyhow ! ( "Invalid converted snapshot name format: {}" , filename) ) ?;
412
-
413
406
remove_dir_all ( & ledger_dir) . with_context ( || {
414
407
format ! (
415
408
"Failed to remove old ledger state snapshot directory: {}" ,
416
409
ledger_dir. display( )
417
410
)
418
411
} ) ?;
419
-
420
412
create_dir ( & ledger_dir) . with_context ( || {
421
413
format ! (
422
414
"Failed to recreate ledger state snapshot directory: {}" ,
423
415
ledger_dir. display( )
424
416
)
425
417
} ) ?;
426
-
427
418
let destination = ledger_dir. join ( slot_number) ;
428
419
rename ( converted_snapshot_path, & destination) . with_context ( || {
429
420
format ! (
0 commit comments