mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-07-31 12:21:25 +00:00
Warning check for duplicate note insertion
This commit is contained in:
@@ -772,7 +772,6 @@ impl LightWallet {
|
|||||||
info!("Txid {} belongs to wallet", tx.txid);
|
info!("Txid {} belongs to wallet", tx.txid);
|
||||||
|
|
||||||
for spend in &tx.shielded_spends {
|
for spend in &tx.shielded_spends {
|
||||||
// TODO: Add up the spent value here and add it to the WalletTx as a Spent
|
|
||||||
let txid = nfs
|
let txid = nfs
|
||||||
.iter()
|
.iter()
|
||||||
.find(|(nf, _, _)| &nf[..] == &spend.nf[..])
|
.find(|(nf, _, _)| &nf[..] == &spend.nf[..])
|
||||||
@@ -801,16 +800,19 @@ impl LightWallet {
|
|||||||
}
|
}
|
||||||
let tx_entry = txs.get_mut(&tx.txid).unwrap();
|
let tx_entry = txs.get_mut(&tx.txid).unwrap();
|
||||||
tx_entry.total_shielded_value_spent = total_shielded_value_spent;
|
tx_entry.total_shielded_value_spent = total_shielded_value_spent;
|
||||||
|
|
||||||
// Save notes.
|
// Save notes.
|
||||||
for output in tx
|
for output in tx
|
||||||
.shielded_outputs
|
.shielded_outputs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
{
|
{
|
||||||
info!("Received sapling output");
|
info!("Received sapling output");
|
||||||
tx_entry.notes.push(SaplingNoteData::new(
|
|
||||||
&self.extfvks[output.account],
|
let new_note = SaplingNoteData::new(&self.extfvks[output.account], output);
|
||||||
output
|
match tx_entry.notes.iter().find(|nd| nd.nullifier == new_note.nullifier) {
|
||||||
));
|
None => tx_entry.notes.push(new_note),
|
||||||
|
Some(_) => warn!("Tried to insert duplicate note for Tx {}", tx.txid)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user