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 6 files +93 −13
  1. shuv-amp commented at 9:12 AM on February 28, 2026: none

    Fixes #29711.

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

    Treat an empty bump-fee map for non-empty requested outpoints as calculation failure, and return the existing descriptive wallet error instead of leaking an internal 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, and checking that spending succeeds again after mining a block.

    Tested:

    • build-local/bin/test_bitcoin --run_test=miniminer_tests --catch_system_errors=no
    • build-local/bin/test_bitcoin --run_test=spend_tests --catch_system_errors=no
    • build-local/bin/test_bitcoin --run_test=coinselector_tests/bump_fee_test --catch_system_errors=no
    • python3 build-local/test/functional/test_runner.py wallet_spend_unconfirmed.py
    • python3 build-local/test/functional/test_runner.py wallet_sendall.py
  2. DrahtBot added the label Wallet on Feb 28, 2026
  3. DrahtBot commented at 9:12 AM on February 28, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34962 (wallet: fix crash in coin selection with enormous unconfirmed clusters by cprkrn)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. in src/node/mini_miner.cpp:309 in 5f94606927
     305 | @@ -306,9 +306,9 @@ std::map<Txid, uint32_t> MiniMiner::Linearize()
     306 |      return m_inclusion_order;
     307 |  }
     308 |  
     309 | -std::map<COutPoint, CAmount> MiniMiner::CalculateBumpFees(const CFeeRate& target_feerate)
     310 | +std::optional<std::map<COutPoint, CAmount>> MiniMiner::CalculateBumpFees(const CFeeRate& target_feerate)
    


    achow101 commented at 10:43 PM on March 24, 2026:

    Changing this to be std::optional seems a bit unnecessary to me as it's equivalently easy to check for !empty(). That probably reduces the diff by half.


    shuv-amp commented at 2:05 AM on March 25, 2026:

    Makes sense. I'll simplify this by keeping the map return type and detecting failure based on whether entries were produced for all requested outpoints, rather than changing the interface to return std::optional.

  5. shuv-amp force-pushed on Mar 25, 2026
  6. wallet: handle MiniMiner bump fee calculation failures
    When MiniMiner cannot calculate individual bump fees, wallet funding can
    index missing bump-fee entries and surface `map::at` to users.
    
    Keep individual bump-fee calculation returning a map, and treat an empty
    map for non-empty requested outpoints as calculation failure. Return the
    existing descriptive wallet error instead of leaking an internal
    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, and checking
    that spending succeeds again after mining a block.
    69b9601da8
  7. shuv-amp force-pushed on Mar 25, 2026

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-04-15 03:12 UTC

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