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
+1
View File
@@ -504,6 +504,7 @@ pub fn wallet_command(
command::cancel(inst_wallet(), a)
}
("restore", Some(_)) => command::restore(inst_wallet()),
("check_repair", Some(_)) => command::check_repair(inst_wallet()),
_ => {
let msg = format!("Unknown wallet command, use 'grin help wallet' for details");
return Err(ErrorKind::ArgumentError(msg).into());
+22
View File
@@ -443,6 +443,28 @@ mod wallet_tests {
Ok(())
})?;
// Another file exchange, don't send, but unlock with repair command
let arg_vec = vec![
"grin",
"wallet",
"-p",
"password",
"-a",
"mining",
"send",
"-m",
"file",
"-d",
&file_name,
"-g",
"Ain't sending",
"10",
];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
let arg_vec = vec!["grin", "wallet", "-p", "password", "check_repair"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
// txs and outputs (mostly spit out for a visual in test logs)
let arg_vec = vec!["grin", "wallet", "-p", "password", "-a", "mining", "txs"];
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
+3 -1
View File
@@ -292,5 +292,7 @@ subcommands:
long: recovery_phrase
takes_value: true
- restore:
about: Initialize a new wallet seed file and database
about: Restores a wallet contents from a seed file
- check_repair:
about: Checks a wallet's outputs against a live node, repairing and restoring missing outputs if required