feat: use checked addition for u64

This commit is contained in:
thesimplekid
2025-02-12 12:27:05 +00:00
parent fedd4b9e58
commit 85ea5fff74
7 changed files with 29 additions and 6 deletions

View File

@@ -205,7 +205,13 @@ impl MintLightning for LNbits {
false => MeltQuoteState::Paid,
};
let total_spent = Amount::from((invoice_info.amount + invoice_info.fee).unsigned_abs());
let total_spent = Amount::from(
(invoice_info
.amount
.checked_add(invoice_info.fee)
.ok_or(Error::AmountOverflow)?)
.unsigned_abs(),
);
Ok(PayInvoiceResponse {
payment_lookup_id: pay_response.payment_hash,