Tidy account manager CLI, add logging

This commit is contained in:
Paul Hauner
2019-11-29 10:39:40 +11:00
parent e9bb716fda
commit e277996b16
2 changed files with 9 additions and 4 deletions

View File

@@ -64,7 +64,6 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.long("testnet-dir") .long("testnet-dir")
.value_name("DIRECTORY") .value_name("DIRECTORY")
.takes_value(true) .takes_value(true)
.default_value("0")
.help("The directory from which to read the deposit contract address."), .help("The directory from which to read the deposit contract address."),
) )
.subcommand( .subcommand(

View File

@@ -179,8 +179,14 @@ fn run_new_validator_subcommand<T: EthSpec>(
.parse::<PathBuf>() .parse::<PathBuf>()
.map_err(|e| format!("Unable to parse testnet-dir: {}", e))?; .map_err(|e| format!("Unable to parse testnet-dir: {}", e))?;
let eth2_testnet_dir: Eth2TestnetDir<T> = Eth2TestnetDir::load(testnet_dir) info!(
.map_err(|e| format!("Failed to load testnet dir: {}", e))?; log,
"Loading deposit contract address";
"testnet_dir" => format!("{:?}", &testnet_dir)
);
let eth2_testnet_dir: Eth2TestnetDir<T> = Eth2TestnetDir::load(testnet_dir.clone())
.map_err(|e| format!("Failed to load testnet dir at {:?}: {}", testnet_dir, e))?;
// Convert from `types::Address` to `web3::types::Address`. // Convert from `types::Address` to `web3::types::Address`.
Address::from_slice( Address::from_slice(
@@ -191,7 +197,7 @@ fn run_new_validator_subcommand<T: EthSpec>(
} else { } else {
matches matches
.value_of("deposit-contract") .value_of("deposit-contract")
.ok_or_else(|| "No deposit-contract".to_string())? .ok_or_else(|| "No --deposit-contract or --testnet-dir".to_string())?
.parse::<Address>() .parse::<Address>()
.map_err(|e| format!("Unable to parse deposit-contract: {}", e))? .map_err(|e| format!("Unable to parse deposit-contract: {}", e))?
}; };