Skip to content

wallet: feebumper, fix crash when combined bump fee is unavailable#34870

Merged
achow101 merged 1 commit intobitcoin:masterfrom
furszy:2026_feebumper_crash_fix
Mar 24, 2026
Merged

wallet: feebumper, fix crash when combined bump fee is unavailable#34870
achow101 merged 1 commit intobitcoin:masterfrom
furszy:2026_feebumper_crash_fix

Conversation

@furszy
Copy link
Copy Markdown
Member

@furszy furszy commented Mar 19, 2026

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 (https://en.cppreference.com/w/cpp/utility/optional/value.html).

Fix this by returning early when the bumped fee is null.

Note:
This is a crash for the GUI, and an uncaught exception for the RPC
bumpfee and psbtbumpfee.

@DrahtBot
Copy link
Copy Markdown
Contributor

DrahtBot commented Mar 19, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK luke-jr, rkrux, achow101

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

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.
@furszy furszy force-pushed the 2026_feebumper_crash_fix branch from 7bd27f9 to 6072a2a Compare March 19, 2026 19:11
Copy link
Copy Markdown
Member

@luke-jr luke-jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 6072a2a

Copy link
Copy Markdown
Contributor

@rkrux rkrux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crACK 6072a2a based on returning before accessing the null optional.

When a large cluster of unconfirmed transactions exceeds the limit,
calculateCombinedBumpFee() returns std::nullopt.

The error message caught my eye because it is dependent on the optional being empty, which is an underlying assumption made by the code. Nothing needs to changed for it in this PR but I found it noteworthy.

Some more investigation showed me there is no test coverage for this conditional, so I created a (relatively) good first issue for it here: #34902.

@achow101
Copy link
Copy Markdown
Member

ACK 6072a2a

@achow101 achow101 merged commit fbabe86 into bitcoin:master Mar 24, 2026
26 checks passed
@furszy furszy deleted the 2026_feebumper_crash_fix branch March 24, 2026 02:04
fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Mar 24, 2026
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.

Github-Pull: bitcoin#34870
Rebased-From: 6072a2a
@fanquake fanquake mentioned this pull request Mar 24, 2026
@fanquake
Copy link
Copy Markdown
Member

Backported to 31.x in #34800.

fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Mar 24, 2026
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.

Github-Pull: bitcoin#34870
Rebased-From: 6072a2a
@fanquake
Copy link
Copy Markdown
Member

Backported to 30.x in #34856.

@fanquake fanquake mentioned this pull request Mar 24, 2026
achow101 added a commit that referenced this pull request Mar 25, 2026
b241f3c doc: update example bitcoin conf for 31.0rc2 (fanquake)
718c31c doc: update manual pages for v31.0rc2 (fanquake)
a30e505 build: bump version to v31.0rc2 (fanquake)
ac13aca test: scale IPC mining wait timeouts by timeout_factor (Enoch Azariah)
39c8762 test: verify IPC error handling for invalid coinbase (Enoch Azariah)
6609473 test: move make_mining_ctx to ipc_util.py (Enoch Azariah)
acd7e3d test: verify createNewBlock wakes promptly when tip advances (Enoch Azariah)
e3d5716 test: Remove confusing assert_debug_log in wallet_reindex.py (MarcoFalke)
87d1691 wallet: feebumper, fix crash when combined bump fee is unavailable (furszy)
11b6992 wallet: fix amount computed as boolean in coin selection (furszy)
d171afa ci: Temporarily use clang in valgrind tasks (MarcoFalke)
198bc4d ci: Clarify why valgrind task has gui disabled (MarcoFalke)
6993aa1 test: Scale feature_dbcrash.py timeout with factor (MarcoFalke)
051afe9 depends: Remove no longer necessary `dsymutil` (Hennadii Stepanov)
3b79852 depends: Fix cross-compiling on macOS for Windows (Hennadii Stepanov)
e53c20d gui: Fix TransactionsView on setCurrentWallet (pablomartin4btc)
7118559 tests: applied PYTHON_GIL to the env for every test (kevkevinpal)
d9a5791 ci: Avoid intermittent Windows generate download failures (MarcoFalke)
335a098 kernel: acquire coinstats cursor and block info atomically (w0xlt)
e930c6d rpc: fix race condition in gettxoutsetinfo (w0xlt)
ca781e4 cmake: Migrate away from deprecated SQLite3 target (Daniel Pfeifer)
0689512 test: [refactor] Use verbosity=0 named arg (MarcoFalke)
8379f00 test: Fix intermittent issue in feature_assumeutxo.py (MarcoFalke)
72d6c88 test: Move event loop creation to network thread (MarcoFalke)
c7127f2 test: Use asyncio.SelectorEventLoop() over deprecated asyncio.WindowsSelectorEventLoopPolicy() (MarcoFalke)
a69f8c3 ci: Use arch-appropriate binaries in lint install (will)
e3383ac ci: check macos bundle structure and codesigning (fanquake)
ab37d3d macdeploy: use plugins dir to find plugins (fanquake)
bb9fcff macdeploy: subprocess out to zip rather than shutil.make_archive (fanquake)
d20ba02 build: Set AUTHOR_WARNING on warnings (MarcoFalke)
2724c39 guix: Make guix-clean less destructive (Hodlinator)
a28d78c test: use static methods and clarify comment in addr_relay (stratospher)
5642a2b test: protect outbound connection from eviction in getaddr_test (stratospher)
a3c1eda test: fix addr relay test silent pass and wrong peerinfo index (stratospher)
207087b ci: bump cirruslabs actions versions (will)
a74dfe3 lint: Temporarily revert to vulture==2.14 (MarcoFalke)
f7f7e68 ci: Bump GHA actions versions (MarcoFalke)
a3ffff0 depends: delete Boost extra files (fanquake)
9852bbd depends: disable Qt sbom generation (fanquake)

Pull request description:

  Backports:
  * #33144
  * #34451
  * #34589
  * #34727
  * #34750
  * #34755
  * #34776
  * #34787
  * #34802
  * #34814
  * #34815
  * #34820
  * #34852
  * #34832
  * #34848
  * #34850
  * #34857
  * #34859
  * #34869
  * #34870
  * #34878
  * #34888

  Gui:
  * bitcoin-core/gui#815

ACKs for top commit:
  Sjors:
    ACK b241f3c
  achow101:
    ACK b241f3c

Tree-SHA512: bb68f5b6e569781805c741d63a6ad6f955c1964d9186defa892936160e8444900f1e4175a1ef4fff268b655d664ddf0b914795ef554ea60cb23a054b080b4805
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants