wallet: guard against negative bump fee discount from mempool race #34530

pull DukeDeSouth wants to merge 1 commits into bitcoin:master from DukeDeSouth:fix/wallet-bump-fee-discount-race changing 1 files +8 −1
  1. DukeDeSouth commented at 1:48 am on February 7, 2026: none

    Human View

    The bump fee discount (summed_bump_fees - combined_bump_fee) can become negative when the mempool state changes between the two MiniMiner calculations. Each MiniMiner only holds cs_main for the duration of its constructor, so fee deltas, new transactions, or evictions in between cause the values to diverge.

    When the combined fee exceeds the sum of individual fees, the difference is negative. The truthiness check if (bump_fee_overestimate) passes (non-zero), and SetBumpFeeDiscount hits assert(discount >= 0), crashing the node.

    Fix: Change the condition from if (bump_fee_overestimate) to if (bump_fee_overestimate > 0) so negative overestimates are simply skipped. The discount is a waste-metric optimisation, not a correctness requirement.

    Fixes #34232


    AI View (DCCE Protocol v1.0)

    Metadata

    • Generator: Claude (Anthropic) via Cursor IDE
    • Methodology: AI-assisted development with human oversight and review

    AI Contribution Summary

    • Solution design and implementation

    Verification Steps Performed

    1. Reproduced the reported issue
    2. Analyzed source code to identify root cause
    3. Implemented and tested the fix

    Human Review Guidance

    • Review the implementation for correctness and completeness
    • Verify test coverage matches the described scenarios

    Made with M7 Cursor

  2. wallet: guard against negative bump fee discount from mempool race
    The bump fee discount (summed individual fees minus combined fee) can
    become negative when the mempool state changes between the two
    MiniMiner calculations.  Each MiniMiner only holds cs_main for the
    duration of its constructor, so fee deltas, new transactions or
    evictions in between cause the values to diverge.
    
    When the combined fee exceeds the sum of individual fees the
    difference is negative, the truthiness check `if (bump_fee_overestimate)`
    passes, and SetBumpFeeDiscount hits `assert(discount >= 0)`.
    
    Fix by changing the condition to `> 0` so negative overestimates are
    simply skipped — the discount is a waste-metric optimisation, not a
    correctness requirement.
    
    Fixes #34232
    
    Co-authored-by: Cursor <cursoragent@cursor.com>
    c43bd1037d
  3. DrahtBot added the label Wallet on Feb 7, 2026
  4. DrahtBot commented at 1:48 am on February 7, 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.

  5. fanquake closed this on Feb 10, 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-02-11 18:13 UTC

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