Fix melt change amount

This commit is contained in:
David Caseria
2024-09-20 18:31:14 -04:00
committed by thesimplekid
parent 11fa39a003
commit 4ba2b07418

View File

@@ -1391,6 +1391,11 @@ impl Wallet {
return Err(Error::UnknownQuote);
};
let proofs_total = Amount::try_sum(proofs.iter().map(|p| p.amount))?;
if proofs_total < quote_info.amount + quote_info.fee_reserve {
return Err(Error::InsufficientFunds);
}
let ys = proofs
.iter()
.map(|p| p.y())
@@ -1410,7 +1415,7 @@ impl Wallet {
active_keyset_id,
count,
self.xpriv,
quote_info.fee_reserve,
proofs_total - quote_info.amount,
)?;
let melt_response = self