Skip to content

Commit

Permalink
Merge pull request zingolabs#1415 from fluidvanadium/no_expectations
Browse files Browse the repository at this point in the history
Remove assumptions that caused a thread panic
  • Loading branch information
Oscar-Pepper authored Sep 23, 2024
2 parents eeb8119 + 654458a commit f25f2c1
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions zingolib/src/wallet/transaction_records_by_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,17 @@ impl TransactionRecordsById {
spending_txid: TxId,
spend_status: Option<(TxId, ConfirmationStatus)>,
) {
let spending_tx = self
.get(&spending_txid)
.expect("transaction must exist in wallet");
let orchard_nullifiers = spending_tx.spent_orchard_nullifiers.clone();
let sapling_nullifiers = spending_tx.spent_sapling_nullifiers.clone();

orchard_nullifiers
.iter()
.for_each(|nf| self.update_orchard_note_spend_status(nf, spend_status));
sapling_nullifiers
.iter()
.for_each(|nf| self.update_sapling_note_spend_status(nf, spend_status));
if let Some(spending_tx) = self.get(&spending_txid) {
let orchard_nullifiers = spending_tx.spent_orchard_nullifiers.clone();
let sapling_nullifiers = spending_tx.spent_sapling_nullifiers.clone();

orchard_nullifiers
.iter()
.for_each(|nf| self.update_orchard_note_spend_status(nf, spend_status));
sapling_nullifiers
.iter()
.for_each(|nf| self.update_sapling_note_spend_status(nf, spend_status));
}
}

fn find_sapling_spend(&self, nullifier: &sapling_crypto::Nullifier) -> Option<&SaplingNote> {
Expand Down

0 comments on commit f25f2c1

Please sign in to comment.