T3 Wallet Restore fix and refactor (#1202)

* clean up wallet restore and underlying functions

* rustfmt

* refactor restore
This commit is contained in:
Yeastplume
2018-06-26 18:24:40 +01:00
committed by GitHub
parent 14667bfad6
commit ccf862f76b
12 changed files with 377 additions and 274 deletions
+13 -8
View File
@@ -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"),
}