mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-07 06:07:32 +02:00
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.
This commit is contained in:
@@ -80,9 +80,10 @@ static feebumper::Result CheckFeeRate(const CWallet& wallet, const CMutableTrans
|
||||
reused_inputs.push_back(txin.prevout);
|
||||
}
|
||||
|
||||
std::optional<CAmount> combined_bump_fee = wallet.chain().calculateCombinedBumpFee(reused_inputs, newFeerate);
|
||||
const std::optional<CAmount> 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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user