fix crash on single unspent note

This commit is contained in:
Cryptoforge 2020-09-18 12:35:13 -07:00
parent ea64467363
commit ae09cb3707

View File

@ -1363,11 +1363,12 @@ impl LightWallet {
for spend in &tx.shielded_spends { for spend in &tx.shielded_spends {
let txid = nfs let txid = nfs
.iter() .iter()
.find(|(nf, _, _)| &nf[..] == &spend.nullifier[..]) .find(|(nf, _, _)| &nf[..] == &spend.nullifier[..]);
.unwrap()
.2; match txid {
Some(id) => {
let spent_note = txs let spent_note = txs
.get_mut(&txid) .get_mut(&id.2)
.unwrap() .unwrap()
.notes .notes
.iter_mut() .iter_mut()
@ -1377,7 +1378,11 @@ impl LightWallet {
zinputs.push(encode_payment_address( zinputs.push(encode_payment_address(
self.config.hrp_sapling_address(), self.config.hrp_sapling_address(),
&spent_note.extfvk.fvk.vk &spent_note.extfvk.fvk.vk
.to_payment_address(spent_note.diversifier, &JUBJUB).unwrap())); .to_payment_address(spent_note.diversifier, &JUBJUB).unwrap()))
},
None => {}
};
} }