wallet: fix negative bump fees after clearing a coin selection #36964

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/reset-coin-selection-discount changing 2 files +4 −0
  1. l0rinc commented at 2:35 PM on November 24, 2026: contributor

    Problem: SelectionResult::Clear() removes the selected inputs but keeps their bump fee discount. GetTotalBumpFees() then subtracts that discount from zero, so any positive discount gives the empty selection a negative fee total. The wallet currently avoids this because it only clears selections inside the knapsack solver, before applying the discount.

    Fix: Reset the discount along with the inputs it applies to.

  2. DrahtBot added the label Wallet on Nov 24, 2026
  3. DrahtBot commented at 2:36 PM on November 24, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36614 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36614.svg"></sub> (test: cover SelectionResult::Merge, GetTotalBumpFees and EligibleForSpending by Naomi-Gift)

    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. test: check bump fees after clearing a selection
    Reuse a selection with a known bump fee discount.
    Clearing its inputs leaves the discount behind, so the empty selection reports negative bump fees.
    dde9db3a6f
  5. wallet: reset the bump fee discount when clearing inputs
    The discount accounts for shared ancestors of the selected inputs.
    Once those inputs are gone, subtracting their discount gives the empty selection a negative bump fee total.
    4ce6b53149
  6. l0rinc force-pushed on Nov 24, 2026
Contributors
Labels

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-11-28 05:51 UTC

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