T3 Wallet Restore fix and refactor (#1202)
* clean up wallet restore and underlying functions * rustfmt * refactor restore
This commit is contained in:
+13
-8
@@ -40,8 +40,8 @@ pub mod tui;
|
||||
|
||||
use std::env::current_dir;
|
||||
use std::process::exit;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -722,13 +722,18 @@ fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) {
|
||||
Ok(())
|
||||
}
|
||||
("restore", Some(_)) => {
|
||||
let _res = api.restore().unwrap_or_else(|e| {
|
||||
panic!(
|
||||
"Error getting restoring wallet: {:?} Config: {:?}",
|
||||
e, wallet_config
|
||||
)
|
||||
});
|
||||
Ok(())
|
||||
let result = api.restore();
|
||||
match result {
|
||||
Ok(_) => {
|
||||
info!(LOGGER, "Wallet restore complete",);
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => {
|
||||
error!(LOGGER, "Wallet restore failed: {:?}", e);
|
||||
error!(LOGGER, "Backtrace: {}", e.backtrace().unwrap());
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => panic!("Unknown wallet command, use 'grin help wallet' for details"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user