Skip to content

Commit 7e76079

Browse files
chore: moved the parsing of flag
1 parent d78867d commit 7e76079

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

beacon_node/lighthouse_network/src/service/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ impl<E: EthSpec> Network<E> {
203203
if let Some(false_count) = config.advertise_false_custody_group_count {
204204
false_count
205205
} else {
206-
ctx.chain_spec.custody_group_count(config.subscribe_all_data_column_subnets)
206+
ctx.chain_spec
207+
.custody_group_count(config.subscribe_all_data_column_subnets)
207208
}
208209
});
209210
let meta_data = utils::load_or_build_metadata(&config.network_dir, custody_group_count);

beacon_node/src/config.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use std::str::FromStr;
3030
use std::time::Duration;
3131
use tracing::{error, info, warn};
3232
use types::graffiti::GraffitiString;
33-
use types::{Checkpoint, Epoch, EthSpec, Hash256, PublicKeyBytes};
33+
use types::{ChainSpec, Checkpoint, Epoch, EthSpec, Hash256, PublicKeyBytes};
3434

3535
const PURGE_DB_CONFIRMATION: &str = "confirm";
3636

@@ -49,17 +49,6 @@ pub fn get_config<E: EthSpec>(
4949

5050
let mut client_config = ClientConfig::default();
5151

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-
6352
// Update the client's data directory
6453
client_config.set_data_dir(get_data_dir(cli_args));
6554

@@ -119,7 +108,12 @@ pub fn get_config<E: EthSpec>(
119108

120109
let data_dir_ref = client_config.data_dir().clone();
121110

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+
)?;
123117

124118
/*
125119
* Staking flag
@@ -1155,6 +1149,7 @@ pub fn set_network_config(
11551149
config: &mut NetworkConfig,
11561150
cli_args: &ArgMatches,
11571151
data_dir: &Path,
1152+
spec: Option<&ChainSpec>,
11581153
) -> Result<(), String> {
11591154
// If a network dir has been specified, override the `datadir` definition.
11601155
if let Some(dir) = cli_args.get_one::<String>("network-dir") {
@@ -1184,6 +1179,14 @@ pub fn set_network_config(
11841179
if let Some(false_custody_group_count) =
11851180
clap_utils::parse_optional(cli_args, "advertise-false-custody-group-count")?
11861181
{
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+
}
11871190
config.advertise_false_custody_group_count = Some(false_custody_group_count);
11881191
}
11891192

boot_node/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<E: EthSpec> BootNodeConfig<E> {
5353

5454
let mut network_config = NetworkConfig::default();
5555

56-
set_network_config(&mut network_config, matches, &data_dir)?;
56+
set_network_config(&mut network_config, matches, &data_dir, None)?;
5757

5858
// Set the Enr Discovery ports to the listening ports if not present.
5959
if let Some(listening_addr_v4) = network_config.listen_addrs().v4() {

0 commit comments

Comments
 (0)