Skip to content

Commit

Permalink
Fix order of testnet config load (#1558)
Browse files Browse the repository at this point in the history
## Issue Addressed

Fixes #1552 

## Proposed Changes

Earlier, we were always loading the hardcoded default testnet config which is a mainnet spec. So running lighthouse with `--spec` option anything other than mainnet gave errors because we tried loading a mainnet genesis spec with `minimal`/`interop` flags.

This PR fixes the order of loading such that we load the hardcoded default spec only if neither `--testnet` and `--testnet-dir` flags are present.
  • Loading branch information
pawanjay176 committed Aug 21, 2020
1 parent 2bc9115 commit 3bd823e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lighthouse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,16 @@ fn run<E: EthSpec>(

// Parse testnet config from the `testnet` and `testnet-dir` flag in that order
// else, use the default
let mut optional_testnet_config = Eth2TestnetConfig::hard_coded_default()?;
let mut optional_testnet_config = None;
if matches.is_present("testnet") {
optional_testnet_config = clap_utils::parse_hardcoded_network(matches, "testnet")?;
};
if matches.is_present("testnet-dir") {
optional_testnet_config = clap_utils::parse_testnet_dir(matches, "testnet-dir")?;
};
if optional_testnet_config.is_none() {
optional_testnet_config = Eth2TestnetConfig::hard_coded_default()?;
}

let builder = if let Some(log_path) = matches.value_of("logfile") {
let path = log_path
Expand Down

0 comments on commit 3bd823e

Please sign in to comment.