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:
+21
-1
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user