@@ -7,7 +7,10 @@ use std::{
77use anyhow:: { Context , anyhow} ;
88use chrono:: Utc ;
99use clap:: Parser ;
10- use mithril_client:: { ComputeCardanoDatabaseMessageError , ImmutableFilesLists , MithrilResult } ;
10+ use mithril_client:: {
11+ ComputeCardanoDatabaseMessageError , ImmutableFilesLists , MithrilResult ,
12+ common:: ImmutableFileNumber ,
13+ } ;
1114
1215use crate :: {
1316 CommandContext ,
@@ -38,6 +41,18 @@ pub struct CardanoDbVerifyCommand {
3841 /// Genesis verification key to check the certificate chain.
3942 #[ clap( long, env = "GENESIS_VERIFICATION_KEY" ) ]
4043 genesis_verification_key : Option < String > ,
44+
45+ /// The first immutable file number to verify.
46+ ///
47+ /// If not set, the verify process will start from the first immutable file.
48+ #[ clap( long) ]
49+ start : Option < ImmutableFileNumber > ,
50+
51+ /// The last immutable file number to verify.
52+ ///
53+ /// If not set, the verify will continue until the last certified immutable file.
54+ #[ clap( long) ]
55+ end : Option < ImmutableFileNumber > ,
4156}
4257
4358impl CardanoDbVerifyCommand {
@@ -94,6 +109,17 @@ impl CardanoDbVerifyCommand {
94109 . await ?
95110 . with_context ( || format ! ( "Can not get the cardano db for hash: '{}'" , self . digest) ) ?;
96111
112+ let immutable_file_range = shared_steps:: immutable_file_range ( self . start , self . end ) ;
113+
114+ let range_to_verify = immutable_file_range
115+ . to_range_inclusive ( cardano_db_message. beacon . immutable_file_number ) ?;
116+
117+ eprintln ! (
118+ "Verifying local immutable files from number {} to {}" ,
119+ range_to_verify. start( ) ,
120+ range_to_verify. end( )
121+ ) ; //TODO add also json output ?
122+
97123 let certificate = shared_steps:: fetch_certificate_and_verifying_chain (
98124 1 ,
99125 & progress_printer,
@@ -102,8 +128,6 @@ impl CardanoDbVerifyCommand {
102128 )
103129 . await ?;
104130
105- let immutable_file_range = shared_steps:: immutable_file_range ( None , None ) ;
106-
107131 let verified_digests = shared_steps:: download_and_verify_digests (
108132 2 ,
109133 & progress_printer,
0 commit comments