Skip to content

wallet: handle MiniMiner bump fee calculation failures - #34698

Open
shuv-amp wants to merge 1 commit into
bitcoin:masterfrom
shuv-amp:fix-wallet-bump-fee-error
Open

shuv-amp wants to merge 1 commit into
bitcoin:masterfrom
shuv-amp:fix-wallet-bump-fee-error

Conversation

@shuv-amp

@shuv-amp shuv-amp commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #29711.

When MiniMiner cannot calculate individual bump fees, wallet funding can
index missing bump-fee entries and return map::at to users.

Treat an empty bump-fee map for non-empty requested outpoints as a
calculation failure. Make AvailableCoins return
util::Result<CoinsResult> so transaction creation and sendall can
propagate the wallet error instead of leaking an internal exception.

Add a functional regression test in wallet_spend_unconfirmed.py
covering the large unconfirmed set scenario from #29711. The test checks
auto-selected inputs, manually selected inputs, and sendall, and verifies
that spending succeeds again after mining a block.

Tested:

  • cmake --build build
  • build/bin/test_bitcoin --catch_system_errors=no
  • build/bin/test_bitcoin --run_test=miniminer_tests --catch_system_errors=no
  • build/bin/test_bitcoin --run_test=spend_tests --catch_system_errors=no
  • build/bin/test_bitcoin --run_test=coinselector_tests/bump_fee_test --catch_system_errors=no
  • build/bin/test_bitcoin --run_test=wallet_tests/ListCoinsTest --catch_system_errors=no
  • build/bin/test_bitcoin --run_test=wallet_tests/BasicOutputTypesTest --catch_system_errors=no
  • python3 build/test/functional/test_runner.py wallet_spend_unconfirmed.py wallet_sendall.py wallet_send.py wallet_fundrawtransaction.py wallet_bumpfee.py wallet_create_tx.py wallet_basic.py
  • build/bin/bench_bitcoin -filter='WalletAvailableCoins|WalletCreateTxUseOnlyPresetInputs|WalletCreateTxUsePresetInputsAndCoinSelection' -sanity-check

@DrahtBot

DrahtBot commented Feb 28, 2026 •

Copy link
Copy Markdown
Contributor

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK achow101
Approach ACK laxmanacharya8

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #35302 (Silent Payments: Sending (take 2) by Eunovo)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Comment thread src/node/mini_miner.cpp Resolved
Comment thread src/wallet/spend.cpp Resolved
calculateIndividualBumpFees returns an empty map when MiniMiner cannot
calculate fees for requested unconfirmed outpoints, such as when
GatherClusters hits its transaction limit. FetchSelectedInputs and
AvailableCoins then index the map and can surface map::at to users.

Return an error when the map is empty for non-empty requested outpoints.
Make AvailableCoins return util::Result<CoinsResult> so transaction creation
and sendall can propagate this error. No-feerate callers keep the existing
behavior by unwrapping the result.

The mini_miner fuzz target asserted that the calculation is always ready,
which no longer holds once that limit is hit, so handle both outcomes
there, and add unit coverage that hitting the limit yields no bump fees.

Add a functional regression test for the bitcoin#29711 scenario. Cover
auto-selected inputs, manually selected inputs, and sendall, and check that
spending succeeds again after mining a block.
@shuv-amp
shuv-amp force-pushed the fix-wallet-bump-fee-error branch from 119c28b to a34afcd Compare August 19, 2026 21:22
@shuv-amp

Copy link
Copy Markdown
Contributor Author

Rebased on master.

Changes since the last round of review:

  • AvailableCoins returns util::Result<CoinsResult> rather than reporting through an
    out-parameter, so the error travels with the result.
  • CreateTransactionInternal moves the CoinsResult instead of copying it.
  • Added a comment at both call sites for why an empty bump-fee map means the calculation
    gave up, and comments in the functional test for the cluster limit the scenario relies on.

@achow101

achow101 commented Oct 2, 2026

Copy link
Copy Markdown
Member

ACK a34afcd

@DrahtBot DrahtBot mentioned this pull request Oct 6, 2026
1 of 2 tasks
@DevaanshPathak

This comment was marked as spam.

@laxmanacharya8

Copy link
Copy Markdown
Contributor

Approach ACK

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.

Wallet: Nondescript error message for 502nd unconfirmed transaction

5 participants