Skip to content

Commit

Permalink
Improve error when user doesn't have a wallet (#2231)
Browse files Browse the repository at this point in the history
## Issue Addressed

NA

## Proposed Changes

I was doing some testing and noticed that this error could be a bit nicer. It helps users understand that they need to create a wallet before a validator.

## Additional Info

NA
  • Loading branch information
paulhauner committed Mar 2, 2021
1 parent ed9b245 commit 02846e9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions account_manager/src/validator/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@ pub fn cli_run<T: EthSpec>(
let count: Option<usize> = clap_utils::parse_optional(matches, COUNT_FLAG)?;
let at_most: Option<usize> = clap_utils::parse_optional(matches, AT_MOST_FLAG)?;

// The command will always fail if the wallet dir does not exist.
if !wallet_base_dir.exists() {
return Err(format!(
"No wallet directory at {:?}. Use the `lighthouse --network {} {} {} {}` command to create a wallet",
wallet_base_dir,
matches.value_of("network").unwrap_or("<NETWORK>"),
crate::CMD,
crate::wallet::CMD,
crate::wallet::create::CMD
));
}

ensure_dir_exists(&validator_dir)?;
ensure_dir_exists(&secrets_dir)?;

Expand Down

0 comments on commit 02846e9

Please sign in to comment.