Add slot-time CLI argument
This commit is contained in:
parent
4aa12dc408
commit
82dc84ebbf
@ -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::<u64>()
|
||||
.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::<PathBuf>()
|
||||
@ -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`.
|
||||
|
@ -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`
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user