Skip to content

Commit

Permalink
fix(wallet): do not prompt for password if given in config (#4040)
Browse files Browse the repository at this point in the history
Description
---
- uses cli password followed by configured password if specified

Motivation and Context
---
Should not prompt for password if given in config

How Has This Been Tested?
---
Manually
  • Loading branch information
sdbondi authored Apr 28, 2022
1 parent 5ebf129 commit fc1aa65
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions applications/tari_console_wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ fn main_inner() -> Result<(), ExitError> {
consts::APP_VERSION
);

// get command line password if provided
let arg_password = cli.password.clone();
let password = cli
.password
.as_ref()
.or(config.wallet.password.as_ref())
.map(|s| s.to_owned());

if arg_password.is_none() {
if password.is_none() {
tari_splash_screen("Console Wallet");
}

Expand All @@ -132,15 +135,14 @@ fn main_inner() -> Result<(), ExitError> {
let recovery_seed = get_recovery_seed(boot_mode, &cli)?;

// get command line password if provided
let arg_password = cli.password.clone();
let seed_words_file_name = cli.seed_words_file_name.clone();

let mut shutdown = Shutdown::new();
let shutdown_signal = shutdown.to_signal();

if cli.change_password {
info!(target: LOG_TARGET, "Change password requested.");
return runtime.block_on(change_password(&config, arg_password, shutdown_signal));
return runtime.block_on(change_password(&config, password, shutdown_signal));
}

// Run our own Tor instance, if configured
Expand All @@ -159,7 +161,7 @@ fn main_inner() -> Result<(), ExitError> {
// initialize wallet
let mut wallet = runtime.block_on(init_wallet(
&config,
arg_password,
password,
seed_words_file_name,
recovery_seed,
shutdown_signal,
Expand Down

0 comments on commit fc1aa65

Please sign in to comment.