From 6072a2a6a1fdde8444e3515f0d201de3fb3923a1 Mon Sep 17 00:00:00 2001 From: furszy Date: Thu, 19 Mar 2026 14:57:45 -0400 Subject: [PATCH] wallet: feebumper, fix crash when combined bump fee is unavailable When a large cluster of unconfirmed transactions exceeds the limit, calculateCombinedBumpFee() returns std::nullopt. Previously, we continued executing and the optional value was accessed unconditionally, leading to a std::bad_optional_access exception. Fix this by returning early when the returned bumped fee is null. Note: This is a crash for the GUI, and an uncaught exception for the RPC bumpfee and psbtbumpfee. --- src/wallet/feebumper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp index ff7a9f5a3ac..7f84c6fa668 100644 --- a/src/wallet/feebumper.cpp +++ b/src/wallet/feebumper.cpp @@ -80,9 +80,10 @@ static feebumper::Result CheckFeeRate(const CWallet& wallet, const CMutableTrans reused_inputs.push_back(txin.prevout); } - std::optional combined_bump_fee = wallet.chain().calculateCombinedBumpFee(reused_inputs, newFeerate); + const std::optional combined_bump_fee = wallet.chain().calculateCombinedBumpFee(reused_inputs, newFeerate); if (!combined_bump_fee.has_value()) { errors.push_back(Untranslated(strprintf("Failed to calculate bump fees, because unconfirmed UTXOs depend on an enormous cluster of unconfirmed transactions."))); + return feebumper::Result::WALLET_ERROR; } CAmount new_total_fee = newFeerate.GetFee(maxTxSize) + combined_bump_fee.value();