@@ -30,7 +30,7 @@ use std::str::FromStr;
30
30
use std:: time:: Duration ;
31
31
use tracing:: { error, info, warn} ;
32
32
use types:: graffiti:: GraffitiString ;
33
- use types:: { Checkpoint , Epoch , EthSpec , Hash256 , PublicKeyBytes } ;
33
+ use types:: { ChainSpec , Checkpoint , Epoch , EthSpec , Hash256 , PublicKeyBytes } ;
34
34
35
35
const PURGE_DB_CONFIRMATION : & str = "confirm" ;
36
36
@@ -49,17 +49,6 @@ pub fn get_config<E: EthSpec>(
49
49
50
50
let mut client_config = ClientConfig :: default ( ) ;
51
51
52
- if let Some ( false_custody_group_count) =
53
- clap_utils:: parse_optional :: < u64 > ( cli_args, "advertise-false-custody-group-count" ) ?
54
- {
55
- if false_custody_group_count > spec. number_of_custody_groups {
56
- return Err ( format ! (
57
- "advertise-false-custody-group-count ({}) exceeds number_of_custody_groups ({})" ,
58
- false_custody_group_count, spec. number_of_custody_groups
59
- ) ) ;
60
- }
61
- }
62
-
63
52
// Update the client's data directory
64
53
client_config. set_data_dir ( get_data_dir ( cli_args) ) ;
65
54
@@ -119,7 +108,12 @@ pub fn get_config<E: EthSpec>(
119
108
120
109
let data_dir_ref = client_config. data_dir ( ) . clone ( ) ;
121
110
122
- set_network_config ( & mut client_config. network , cli_args, & data_dir_ref) ?;
111
+ set_network_config (
112
+ & mut client_config. network ,
113
+ cli_args,
114
+ & data_dir_ref,
115
+ Some ( spec) ,
116
+ ) ?;
123
117
124
118
/*
125
119
* Staking flag
@@ -1155,6 +1149,7 @@ pub fn set_network_config(
1155
1149
config : & mut NetworkConfig ,
1156
1150
cli_args : & ArgMatches ,
1157
1151
data_dir : & Path ,
1152
+ spec : Option < & ChainSpec > ,
1158
1153
) -> Result < ( ) , String > {
1159
1154
// If a network dir has been specified, override the `datadir` definition.
1160
1155
if let Some ( dir) = cli_args. get_one :: < String > ( "network-dir" ) {
@@ -1184,6 +1179,14 @@ pub fn set_network_config(
1184
1179
if let Some ( false_custody_group_count) =
1185
1180
clap_utils:: parse_optional ( cli_args, "advertise-false-custody-group-count" ) ?
1186
1181
{
1182
+ if let Some ( spec) = spec {
1183
+ if false_custody_group_count > spec. number_of_custody_groups {
1184
+ return Err ( format ! (
1185
+ "advertise-false-custody-group-count ({}) exceeds number_of_custody_groups ({})" ,
1186
+ false_custody_group_count, spec. number_of_custody_groups
1187
+ ) ) ;
1188
+ }
1189
+ }
1187
1190
config. advertise_false_custody_group_count = Some ( false_custody_group_count) ;
1188
1191
}
1189
1192
0 commit comments