diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index c3dfad9ba..949b7277e 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -74,7 +74,7 @@ fn process_testnet_subcommand( if let Some(path_string) = cli_args.value_of("eth2-config") { if is_bootstrap { - return Err("Cannot supply --eth2-config when using bootsrap".to_string()); + return Err("Cannot supply --eth2-config when using bootstrap".to_string()); } let path = path_string @@ -85,6 +85,18 @@ fn process_testnet_subcommand( builder.update_spec_from_subcommand(&cli_args)?; } + if let Some(slot_time) = cli_args.value_of("slot-time") { + if is_bootstrap { + return Err("Cannot supply --slot-time flag whilst using bootstrap.".into()); + } + + let slot_time = slot_time + .parse::() + .map_err(|e| format!("Unable to parse slot-time: {:?}", e))?; + + builder.set_slot_time(slot_time); + } + if let Some(path_string) = cli_args.value_of("client-config") { let path = path_string .parse::() @@ -307,6 +319,10 @@ impl<'a> ConfigBuilder<'a> { self.eth2_config = eth2_config; } + fn set_slot_time(&mut self, milliseconds_per_slot: u64) { + self.eth2_config.spec.milliseconds_per_slot = milliseconds_per_slot; + } + /// Reads the subcommand and tries to update `self.eth2_config` based up on the `--spec` flag. /// /// Returns an error if the `--spec` flag is not present in the given `cli_args`. diff --git a/beacon_node/src/main.rs b/beacon_node/src/main.rs index 69ac6f1bd..a2a977e85 100644 --- a/beacon_node/src/main.rs +++ b/beacon_node/src/main.rs @@ -241,6 +241,13 @@ fn main() { backup directory.") .conflicts_with("random-datadir") ) + .arg( + Arg::with_name("slot-time") + .long("slot-time") + .short("t") + .value_name("MILLISECONDS") + .help("Defines the slot time when creating a new testnet.") + ) /* * `boostrap` *