Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: currently newly created wallet does not prompt seed words (#5019) #5022

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/tari_console_wallet/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ async fn validate_txos(wallet: &mut WalletSqlite) -> Result<(), ExitError> {
Ok(())
}

fn confirm_seed_words(wallet: &mut WalletSqlite) -> Result<(), ExitError> {
pub(crate) fn confirm_seed_words(wallet: &mut WalletSqlite) -> Result<(), ExitError> {
let seed_words = wallet.get_seed_words(&MnemonicLanguage::English)?;

println!();
Expand Down
17 changes: 16 additions & 1 deletion applications/tari_console_wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use tokio::runtime::Runtime;
use wallet_modes::{command_mode, grpc_mode, recovery_mode, script_mode, tui_mode, WalletMode};

pub use crate::config::ApplicationConfig;
use crate::init::{boot_with_password, wallet_mode};
use crate::init::{boot_with_password, confirm_seed_words, wallet_mode};

pub const LOG_TARGET: &str = "wallet::console_wallet::main";

Expand Down Expand Up @@ -135,6 +135,9 @@ pub fn run_wallet_with_cli(runtime: Runtime, config: &mut ApplicationConfig, cli
);
}

let on_init = matches!(boot_mode, WalletBoot::New);
let not_recovery = recovery_seed.is_none();

// initialize wallet
let mut wallet = runtime.block_on(init_wallet(
config,
Expand All @@ -145,6 +148,18 @@ pub fn run_wallet_with_cli(runtime: Runtime, config: &mut ApplicationConfig, cli
cli.non_interactive_mode,
))?;

// if wallet is being set for the first time, wallet seed words are prompted on the screen
if !cli.non_interactive_mode && not_recovery && on_init {
match confirm_seed_words(&mut wallet) {
Ok(()) => {
print!("\x1Bc"); // Clear the screen
},
Err(error) => {
return Err(error);
},
};
}

// Check if there is an in progress recovery in the wallet's database
if wallet.is_recovery_in_progress()? {
println!("A Wallet Recovery was found to be in progress, continuing.");
Expand Down