wallet: handle MiniMiner bump fee calculation failures #34698

pull shuv-amp wants to merge 1 commits into bitcoin:master from shuv-amp:fix-wallet-bump-fee-error changing 10 files +101 −23
  1. shuv-amp commented at 9:12 am on February 28, 2026: none

    When MiniMiner cannot calculate individual bump fees (e.g. cluster processing aborts), wallet funding paths can index missing bump-fee entries and return map::at to users.

    This patch makes that failure explicit and propagates it as a wallet error.

    What changes

    • MiniMiner::CalculateBumpFees now returns std::optional<std::map<COutPoint, CAmount>> instead of an always-present map.
    • interfaces::Chain::calculateIndividualBumpFees is updated to match.
    • Wallet funding paths now handle this failure and return the existing descriptive error:
      • send / normal wallet transaction funding path
      • sendall path
    • Added a functional regression test in wallet_spend_unconfirmed.py that:
      • reproduces the large unconfirmed-set scenario from #29711,
      • asserts the descriptive error instead of map::at,
      • verifies spending works again after mining a block.

    Why this is correct

    The previous behavior treated an absent bump-fee result as a map and indexed into it. This patch makes the failure state explicit at the interface boundary and checks it at wallet call sites before indexing.

    This keeps behavior unchanged in successful cases, and only changes the error path from an internal exception (map::at) to the intended wallet-level error.

    Test plan

    • build-local/test/functional/test_runner.py wallet_spend_unconfirmed.py -j 1
    • build-local/test/functional/test_runner.py wallet_sendall.py -j 1
    • build-tsan/bin/test_bitcoin --run_test=miniminer_tests --catch_system_errors=no
    • build-tsan/bin/test_bitcoin --run_test=spend_tests --catch_system_errors=no
    • build-tsan/bin/test_bitcoin --run_test=coinselector_tests/bump_fee_test --catch_system_errors=no
    • python3 test/lint/lint-python.py
    • python3 test/lint/lint-tests.py
    • python3 test/lint/lint-files.py
    • python3 test/lint/lint-includes.py

    Fixes #29711.

  2. wallet: handle MiniMiner bump fee calculation failures
    When MiniMiner cannot calculate individual bump fees (for example when
    cluster processing aborts), wallet funding could index missing bump-fee
    entries and surface `map::at` to users.
    
    Make individual bump-fee calculation explicitly fallible by returning
    `std::optional<std::map<COutPoint, CAmount>>` from MiniMiner and the
    chain interface. Propagate this through wallet funding and return the
    existing descriptive wallet error instead of leaking a map exception.
    
    Handle the same condition in `sendall`, which calls `AvailableCoins`
    directly, so `send` and `sendall` report consistent errors.
    
    Add a functional regression test in `wallet_spend_unconfirmed.py`
    covering the large unconfirmed-set scenario from #29711, asserting the
    wallet error and confirming spending works again after a block is mined.
    
    Tested:
    - test/functional/test_runner.py wallet_spend_unconfirmed.py -j 1
    - test/functional/test_runner.py wallet_sendall.py -j 1
    - test_bitcoin --run_test=miniminer_tests --catch_system_errors=no
    - test_bitcoin --run_test=spend_tests --catch_system_errors=no
    - test_bitcoin --run_test=coinselector_tests/bump_fee_test --catch_system_errors=no
    - python3 test/lint/lint-python.py
    - python3 test/lint/lint-tests.py
    - python3 test/lint/lint-files.py
    - python3 test/lint/lint-includes.py
    5f94606927
  3. DrahtBot added the label Wallet on Feb 28, 2026
  4. DrahtBot commented at 9:12 am on February 28, 2026: contributor

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

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-03 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me