mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-26 01:03:40 +00:00
Add progress on validator onboarding
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
mod cli;
|
||||
pub mod validator;
|
||||
|
||||
use bls::Keypair;
|
||||
use clap::ArgMatches;
|
||||
@@ -15,6 +16,49 @@ pub const DEFAULT_DATA_DIR: &str = ".lighthouse-validator";
|
||||
pub const CLIENT_CONFIG_FILENAME: &str = "account-manager.toml";
|
||||
|
||||
pub fn run<T: EthSpec>(matches: &ArgMatches, context: RuntimeContext<T>) {
|
||||
let log = context.log.clone();
|
||||
match run_account_manager(matches, context) {
|
||||
Ok(()) => (),
|
||||
Err(e) => crit!(log, "Account manager failed"; "error" => e),
|
||||
}
|
||||
}
|
||||
|
||||
fn run_account_manager<T: EthSpec>(
|
||||
matches: &ArgMatches,
|
||||
context: RuntimeContext<T>,
|
||||
) -> Result<(), String> {
|
||||
let log = context.log.clone();
|
||||
|
||||
let data_dir = matches
|
||||
.value_of("datadir")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
let mut default_dir = match dirs::home_dir() {
|
||||
Some(v) => v,
|
||||
None => {
|
||||
panic!("Failed to find a home directory");
|
||||
}
|
||||
};
|
||||
default_dir.push(DEFAULT_DATA_DIR);
|
||||
default_dir
|
||||
});
|
||||
|
||||
fs::create_dir_all(&data_dir).map_err(|e| format!("Failed to initialize data dir: {}", e))?;
|
||||
|
||||
let mut client_config = ValidatorClientConfig::default();
|
||||
client_config.data_dir = data_dir.clone();
|
||||
client_config
|
||||
.apply_cli_args(&matches, &log)
|
||||
.map_err(|e| format!("Failed to parse ClientConfig CLI arguments: {:?}", e))?;
|
||||
|
||||
info!(log, "Located data directory";
|
||||
"path" => &client_config.data_dir.to_str());
|
||||
|
||||
panic!()
|
||||
//
|
||||
}
|
||||
|
||||
pub fn run_old<T: EthSpec>(matches: &ArgMatches, context: RuntimeContext<T>) {
|
||||
let mut log = context.log;
|
||||
|
||||
let data_dir = match matches
|
||||
|
||||
Reference in New Issue
Block a user