From 175471a64b90fb368a27e3ac9377153cf9af7653 Mon Sep 17 00:00:00 2001 From: Pawan Dhananjay Date: Tue, 25 Aug 2020 06:01:42 +0000 Subject: [PATCH] Fix order of testnet config load (#1558) ## 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. --- lighthouse/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 7ad191ea9..52e90f179 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -189,13 +189,16 @@ fn run( // 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