Grin wallet check/repair (#2256)

* first pass at basic check_fix process

* rustfmt

* unlocks and tx log entry reversals in place

* log restore output at warn

* rename check_repair

* rename check_repair

* add command line functionality and sanity test

* rustfmt

* update wallet usage doc with check_repair

* doc update

* consistency in NotEnoughFunds output

* consistency in NotEnoughFunds output
This commit is contained in:
Yeastplume
2018-12-30 16:32:00 +00:00
committed by GitHub
parent dbf8e97b3f
commit 3eb599a45c
14 changed files with 554 additions and 80 deletions
+21 -1
View File
@@ -480,7 +480,7 @@ pub fn restore(
let result = api.restore();
match result {
Ok(_) => {
info!("Wallet restore complete",);
warn!("Wallet restore complete",);
Ok(())
}
Err(e) => {
@@ -492,3 +492,23 @@ pub fn restore(
})?;
Ok(())
}
pub fn check_repair(
wallet: Arc<Mutex<WalletInst<impl NodeClient + 'static, keychain::ExtKeychain>>>,
) -> Result<(), Error> {
controller::owner_single_use(wallet.clone(), |api| {
let result = api.check_repair();
match result {
Ok(_) => {
warn!("Wallet check/repair complete",);
Ok(())
}
Err(e) => {
error!("Wallet check/repair failed: {}", e);
error!("Backtrace: {}", e.backtrace().unwrap());
Err(e)
}
}
})?;
Ok(())
}