'Awaiting finalization' status and changes to 'wallet check' (#8)

* add awaiting confirmation status and change check to not remove unconfirmed transactions by default

* test fixes
This commit is contained in:
Yeastplume
2019-03-07 16:19:47 +00:00
committed by GitHub
parent 6d92a67730
commit ddd9bc2908
12 changed files with 84 additions and 51 deletions
+7 -1
View File
@@ -530,13 +530,19 @@ pub fn restore(
Ok(())
}
/// wallet check
pub struct CheckArgs {
pub delete_unconfirmed: bool,
}
pub fn check_repair(
wallet: Arc<Mutex<WalletInst<impl NodeClient + 'static, keychain::ExtKeychain>>>,
args: CheckArgs,
) -> Result<(), Error> {
controller::owner_single_use(wallet.clone(), |api| {
warn!("Starting wallet check...",);
warn!("Updating all wallet outputs, please wait ...",);
let result = api.check_repair();
let result = api.check_repair(args.delete_unconfirmed);
match result {
Ok(_) => {
warn!("Wallet check complete",);
+5 -1
View File
@@ -270,7 +270,7 @@ pub fn info(
if dark_background_color_scheme {
table.add_row(row![
bFG->"Total",
bFG->"Confirmed Total",
FG->amount_to_hr_string(wallet_info.total, false)
]);
// Only dispay "Immature Coinbase" if we have related outputs in the wallet.
@@ -285,6 +285,10 @@ pub fn info(
bFY->format!("Awaiting Confirmation (< {})", wallet_info.minimum_confirmations),
FY->amount_to_hr_string(wallet_info.amount_awaiting_confirmation, false)
]);
table.add_row(row![
bFB->format!("Awaiting Finalization"),
FB->amount_to_hr_string(wallet_info.amount_awaiting_finalization, false)
]);
table.add_row(row![
Fr->"Locked by previous transaction",
Fr->amount_to_hr_string(wallet_info.amount_locked, false)
+2 -2
View File
@@ -350,8 +350,8 @@ where
Ok(())
}
fn check_repair(&mut self) -> Result<(), Error> {
internal::restore::check_repair(self).context(ErrorKind::Restore)?;
fn check_repair(&mut self, delete_unconfirmed: bool) -> Result<(), Error> {
internal::restore::check_repair(self, delete_unconfirmed).context(ErrorKind::Restore)?;
Ok(())
}
}