From 83dad3c75d5e11d0bfa5031a25c673d283931a61 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Sat, 14 Sep 2024 11:34:29 +0100 Subject: [PATCH] fix: melt inputs outputs check --- crates/cdk/src/mint/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/cdk/src/mint/mod.rs b/crates/cdk/src/mint/mod.rs index a7400dd6..e508a3aa 100644 --- a/crates/cdk/src/mint/mod.rs +++ b/crates/cdk/src/mint/mod.rs @@ -1043,7 +1043,9 @@ impl Mint { let required_total = quote.amount + quote.fee_reserve + fee; - if proofs_total != required_total { + // Check that the inputs proofs are greater then total. + // Transaction does not need to be balanced as wallet may not want change. + if proofs_total <= required_total { tracing::info!( "Swap request unbalanced: {}, outputs {}, fee {}", proofs_total, @@ -1053,7 +1055,7 @@ impl Mint { return Err(Error::TransactionUnbalanced( proofs_total.into(), quote.amount.into(), - fee.into(), + (fee + quote.fee_reserve).into(), )); }