@@ -25,7 +25,8 @@ use mithril_common::{
25
25
use crate :: {
26
26
aggregator_client:: { AggregatorHTTPClientError , CertificateClient , SnapshotClient } ,
27
27
utils:: {
28
- DownloadProgressReporter , ProgressOutputType , SnapshotUnpacker , SnapshotUnpackerError ,
28
+ DownloadProgressReporter , ProgressOutputType , ProgressPrinter , SnapshotUnpacker ,
29
+ SnapshotUnpackerError ,
29
30
} ,
30
31
} ;
31
32
@@ -217,15 +218,15 @@ impl SnapshotService for MithrilClientSnapshotService {
217
218
debug ! ( "Snapshot service: download." ) ;
218
219
219
220
let db_dir = download_dir. join ( "db" ) ;
220
- let progress_bar = MultiProgress :: with_draw_target ( progress_output_type. into ( ) ) ;
221
- progress_bar. println ( "1/7 - Checking local disk info…") ?;
221
+ let progress_bar = ProgressPrinter :: new ( progress_output_type, 7 ) ;
222
+ progress_bar. report_step ( 1 , " Checking local disk info…") ?;
222
223
let unpacker = SnapshotUnpacker ;
223
224
224
225
if let Err ( e) = unpacker. check_prerequisites ( & db_dir, snapshot_entity. artifact . size ) {
225
226
self . check_disk_space_error ( e) ?;
226
227
}
227
228
228
- progress_bar. println ( "2/7 - Fetching the certificate's information…") ?;
229
+ progress_bar. report_step ( 2 , " Fetching the certificate's information…") ?;
229
230
let certificate = self
230
231
. certificate_client
231
232
. get ( & snapshot_entity. certificate_id )
@@ -236,11 +237,11 @@ impl SnapshotService for MithrilClientSnapshotService {
236
237
)
237
238
} ) ?;
238
239
239
- progress_bar. println ( "3/7 - Verifying the certificate chain…") ?;
240
+ progress_bar. report_step ( 3 , " Verifying the certificate chain…") ?;
240
241
let verifier = self . verify_certificate_chain ( genesis_verification_key, & certificate) ;
241
242
self . wait_spinner ( & progress_bar, verifier) . await ?;
242
243
243
- progress_bar. println ( "4/7 - Downloading the snapshot…") ?;
244
+ progress_bar. report_step ( 4 , " Downloading the snapshot…") ?;
244
245
let pb = progress_bar. add ( ProgressBar :: new ( snapshot_entity. artifact . size ) ) ;
245
246
pb. set_style ( ProgressStyle :: with_template ( "{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({eta})" )
246
247
. unwrap ( )
@@ -256,7 +257,7 @@ impl SnapshotService for MithrilClientSnapshotService {
256
257
. await
257
258
. with_context ( || format ! ( "Could not download file in '{}'" , download_dir. display( ) ) ) ?;
258
259
259
- progress_bar. println ( "5/7 - Unpacking the snapshot…") ?;
260
+ progress_bar. report_step ( 5 , " Unpacking the snapshot…") ?;
260
261
let unpacker = unpacker. unpack_snapshot ( & snapshot_path, & db_dir) ;
261
262
self . wait_spinner ( & progress_bar, unpacker) . await ?;
262
263
@@ -268,14 +269,14 @@ impl SnapshotService for MithrilClientSnapshotService {
268
269
) ;
269
270
} ;
270
271
271
- progress_bar. println ( "6/7 - Computing the snapshot digest…") ?;
272
+ progress_bar. report_step ( 6 , " Computing the snapshot digest…") ?;
272
273
let unpacked_snapshot_digest = self
273
274
. immutable_digester
274
275
. compute_digest ( & db_dir, & certificate. beacon )
275
276
. await
276
277
. with_context ( || format ! ( "Could not compute digest in '{}'" , db_dir. display( ) ) ) ?;
277
278
278
- progress_bar. println ( "7/7 - Verifying the snapshot signature…") ?;
279
+ progress_bar. report_step ( 7 , " Verifying the snapshot signature…") ?;
279
280
let expected_message = {
280
281
let mut protocol_message = certificate. protocol_message . clone ( ) ;
281
282
protocol_message. set_message_part (
0 commit comments