mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-25 21:17:17 +00:00
Add more detail to bad hardcoded dir warning (#1069)
This commit is contained in:
parent
dea01be00e
commit
8bf0ef8d30
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -250,6 +250,7 @@ version = "0.2.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"beacon_chain 0.2.0",
|
"beacon_chain 0.2.0",
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"clap_utils 0.1.0",
|
||||||
"client 0.2.0",
|
"client 0.2.0",
|
||||||
"ctrlc 3.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ctrlc 3.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -41,3 +41,4 @@ eth2-libp2p = { path = "./eth2-libp2p" }
|
|||||||
eth2_ssz = { path = "../eth2/utils/ssz" }
|
eth2_ssz = { path = "../eth2/utils/ssz" }
|
||||||
toml = "0.5.4"
|
toml = "0.5.4"
|
||||||
serde = "1.0.102"
|
serde = "1.0.102"
|
||||||
|
clap_utils = { path = "../eth2/utils/clap_utils" }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use beacon_chain::builder::PUBKEY_CACHE_FILENAME;
|
use beacon_chain::builder::PUBKEY_CACHE_FILENAME;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
|
use clap_utils::BAD_TESTNET_DIR_MESSAGE;
|
||||||
use client::{config::DEFAULT_DATADIR, ClientConfig, ClientGenesis};
|
use client::{config::DEFAULT_DATADIR, ClientConfig, ClientGenesis};
|
||||||
use eth2_libp2p::{Enr, Multiaddr};
|
use eth2_libp2p::{Enr, Multiaddr};
|
||||||
use eth2_testnet_config::Eth2TestnetConfig;
|
use eth2_testnet_config::Eth2TestnetConfig;
|
||||||
@ -385,14 +386,8 @@ pub fn get_eth2_testnet_config<E: EthSpec>(
|
|||||||
Eth2TestnetConfig::load(testnet_dir.clone())
|
Eth2TestnetConfig::load(testnet_dir.clone())
|
||||||
.map_err(|e| format!("Unable to open testnet dir at {:?}: {}", testnet_dir, e))?
|
.map_err(|e| format!("Unable to open testnet dir at {:?}: {}", testnet_dir, e))?
|
||||||
} else {
|
} else {
|
||||||
Eth2TestnetConfig::hard_coded().map_err(|e| {
|
Eth2TestnetConfig::hard_coded()
|
||||||
format!(
|
.map_err(|e| format!("{} Error : {}", BAD_TESTNET_DIR_MESSAGE, e))?
|
||||||
"The hard-coded testnet directory was invalid. \
|
|
||||||
This happens when Lighthouse is migrating between spec versions. \
|
|
||||||
Error : {}",
|
|
||||||
e
|
|
||||||
)
|
|
||||||
})?
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,11 @@ use std::path::PathBuf;
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use types::EthSpec;
|
use types::EthSpec;
|
||||||
|
|
||||||
|
pub const BAD_TESTNET_DIR_MESSAGE: &str = "The hard-coded testnet directory was invalid. \
|
||||||
|
This happens when Lighthouse is migrating between spec versions \
|
||||||
|
or when there is no default public network to connect to. \
|
||||||
|
During these times you must specify a --testnet-dir.";
|
||||||
|
|
||||||
/// Attempts to load the testnet dir at the path if `name` is in `matches`, returning an error if
|
/// Attempts to load the testnet dir at the path if `name` is in `matches`, returning an error if
|
||||||
/// the path cannot be found or the testnet dir is invalid.
|
/// the path cannot be found or the testnet dir is invalid.
|
||||||
///
|
///
|
||||||
@ -20,14 +25,8 @@ pub fn parse_testnet_dir_with_hardcoded_default<E: EthSpec>(
|
|||||||
Eth2TestnetConfig::load(path.clone())
|
Eth2TestnetConfig::load(path.clone())
|
||||||
.map_err(|e| format!("Unable to open testnet dir at {:?}: {}", path, e))
|
.map_err(|e| format!("Unable to open testnet dir at {:?}: {}", path, e))
|
||||||
} else {
|
} else {
|
||||||
Eth2TestnetConfig::hard_coded().map_err(|e| {
|
Eth2TestnetConfig::hard_coded()
|
||||||
format!(
|
.map_err(|e| format!("{} Error : {}", BAD_TESTNET_DIR_MESSAGE, e))
|
||||||
"The hard-coded testnet directory was invalid. \
|
|
||||||
This happens when Lighthouse is migrating between spec versions. \
|
|
||||||
Error : {}",
|
|
||||||
e
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user