diff --git a/impls/src/error.rs b/impls/src/error.rs index 85ee501d3..aadb2bd73 100644 --- a/impls/src/error.rs +++ b/impls/src/error.rs @@ -57,6 +57,10 @@ pub enum ErrorKind { #[fail(display = "Wallet seed doesn't exist error")] WalletSeedDoesntExist, + /// Wallet seed doesn't exist + #[fail(display = "Wallet doesn't exist at {}. {}", _0, _1)] + WalletDoesntExist(String, String), + /// Enc/Decryption Error #[fail(display = "Enc/Decryption error (check password?)")] Encryption, diff --git a/impls/src/seed.rs b/impls/src/seed.rs index 4770da334..485f5e604 100644 --- a/impls/src/seed.rs +++ b/impls/src/seed.rs @@ -138,6 +138,13 @@ impl WalletSeed { if WalletSeed::seed_file_exists(wallet_config).is_err() { WalletSeed::backup_seed(wallet_config)?; } + if !Path::new(&wallet_config.data_file_dir).exists() { + return Err(ErrorKind::WalletDoesntExist( + wallet_config.data_file_dir.clone(), + "To create a new wallet from a recovery phrase, use 'grin-wallet init -r'" + .to_owned(), + ))?; + } let seed = WalletSeed::from_mnemonic(word_list)?; let enc_seed = EncryptedWalletSeed::from_seed(&seed, password)?; let enc_seed_json = serde_json::to_string_pretty(&enc_seed).context(ErrorKind::Format)?;