@@ -7,7 +7,10 @@ use std::{
7
7
use anyhow:: { Context , anyhow} ;
8
8
use chrono:: Utc ;
9
9
use clap:: Parser ;
10
- use mithril_client:: { ComputeCardanoDatabaseMessageError , ImmutableFilesLists , MithrilResult } ;
10
+ use mithril_client:: {
11
+ ComputeCardanoDatabaseMessageError , ImmutableFilesLists , MithrilResult ,
12
+ common:: ImmutableFileNumber ,
13
+ } ;
11
14
12
15
use crate :: {
13
16
CommandContext ,
@@ -38,6 +41,18 @@ pub struct CardanoDbVerifyCommand {
38
41
/// Genesis verification key to check the certificate chain.
39
42
#[ clap( long, env = "GENESIS_VERIFICATION_KEY" ) ]
40
43
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 > ,
41
56
}
42
57
43
58
impl CardanoDbVerifyCommand {
@@ -94,6 +109,17 @@ impl CardanoDbVerifyCommand {
94
109
. await ?
95
110
. with_context ( || format ! ( "Can not get the cardano db for hash: '{}'" , self . digest) ) ?;
96
111
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
+
97
123
let certificate = shared_steps:: fetch_certificate_and_verifying_chain (
98
124
1 ,
99
125
& progress_printer,
@@ -102,8 +128,6 @@ impl CardanoDbVerifyCommand {
102
128
)
103
129
. await ?;
104
130
105
- let immutable_file_range = shared_steps:: immutable_file_range ( None , None ) ;
106
-
107
131
let verified_digests = shared_steps:: download_and_verify_digests (
108
132
2 ,
109
133
& progress_printer,
0 commit comments