aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wallet/spend.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 8c0d56a1cb..178b5ff395 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -940,7 +940,9 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
// The only time that fee_needed should be less than the amount available for fees is when
// we are subtracting the fee from the outputs. If this occurs at any other time, it is a bug.
- assert(coin_selection_params.m_subtract_fee_outputs || fee_needed <= nFeeRet);
+ if (!coin_selection_params.m_subtract_fee_outputs && fee_needed > nFeeRet) {
+ return util::Error{Untranslated(STR_INTERNAL_BUG("Fee needed > fee paid"))};
+ }
// If there is a change output and we overpay the fees then increase the change to match the fee needed
if (nChangePosInOut != -1 && fee_needed < nFeeRet) {