mirror of
https://github.com/Qortal/piratewallet-light-cli.git
synced 2025-07-30 03:41:28 +00:00
Update historical utxos with <spent in txid>
This commit is contained in:
@@ -904,12 +904,19 @@ impl LightWallet {
|
|||||||
|
|
||||||
// println!("Looking for {}, {}", txid, vin.prevout.n);
|
// println!("Looking for {}, {}", txid, vin.prevout.n);
|
||||||
|
|
||||||
let value = match self.txs.read().unwrap().get(&txid) {
|
let value = match self.txs.write().unwrap().get_mut(&txid) {
|
||||||
Some(wtx) => {
|
Some(wtx) => {
|
||||||
// One of the tx outputs is a match
|
// One of the tx outputs is a match
|
||||||
wtx.utxos.iter()
|
let spent_utxo = wtx.utxos.iter_mut()
|
||||||
.find(|u| u.txid == txid && u.output_index == (vin.prevout.n as u64))
|
.find(|u| u.txid == txid && u.output_index == (vin.prevout.n as u64));
|
||||||
.map_or(0, |u| u.value)
|
|
||||||
|
match spent_utxo {
|
||||||
|
Some(su) => {
|
||||||
|
su.spent = Some(txid.clone());
|
||||||
|
su.value // Return the value of the note
|
||||||
|
},
|
||||||
|
None => 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user