mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Delete Unconfirmed outputs as part of wallet check_repair (#2261)
* Delete unconfirmed outputs as part of check_repair process * rustfmt
This commit is contained in:
parent
3eb599a45c
commit
9c98b798ee
1 changed files with 20 additions and 1 deletions
|
@ -252,7 +252,7 @@ where
|
|||
accidental_spend_outs.push((s.0.clone(), deffo.clone()));
|
||||
}
|
||||
if s.0.status == OutputStatus::Locked {
|
||||
locked_outs.push((s.0.clone(), deffo));
|
||||
locked_outs.push((s.0.clone(), deffo.clone()));
|
||||
}
|
||||
}
|
||||
None => missing_outs.push(deffo),
|
||||
|
@ -287,6 +287,7 @@ where
|
|||
restore_missing_output(wallet, m, &mut found_parents)?;
|
||||
}
|
||||
|
||||
// Unlock locked outputs
|
||||
for m in locked_outs.into_iter() {
|
||||
let mut o = m.0;
|
||||
warn!(
|
||||
|
@ -301,6 +302,24 @@ where
|
|||
batch.commit()?;
|
||||
}
|
||||
|
||||
let unconfirmed_outs: Vec<&(OutputData, pedersen::Commitment)> = wallet_outputs
|
||||
.iter()
|
||||
.filter(|o| o.0.status == OutputStatus::Unconfirmed)
|
||||
.collect();
|
||||
// Delete unconfirmed outputs
|
||||
for m in unconfirmed_outs.into_iter() {
|
||||
let o = m.0.clone();
|
||||
warn!(
|
||||
"Unconfirmed output for {} with ID {} ({:?}) not in UTXO set. \
|
||||
Deleting and cancelling associated transaction log entries.",
|
||||
o.value, o.key_id, m.1,
|
||||
);
|
||||
cancel_tx_log_entry(wallet, &o)?;
|
||||
let mut batch = wallet.batch()?;
|
||||
batch.delete(&o.key_id)?;
|
||||
batch.commit()?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue