test: add feebumper coverage for combined bump fee calculation failure #34972

pull itdeveloper1988 wants to merge 1 commits into bitcoin:master from itdeveloper1988:fix/issue-34902 changing 1 files +107 −0
  1. itdeveloper1988 commented at 10:40 pm on March 31, 2026: none

    Add a unit test that exercises the error path in CreateRateBumpTransaction when calculateCombinedBumpFee() returns nullopt due to the 500-transaction GatherClusters DoS limit being exceeded (feebumper.cpp lines 83-87).

    The test works by:

    • Building 501 mempool transactions across 10 independent chains (first chain has 51 transactions, remaining nine have 50 each) using TryAddToMempool to bypass cluster policy limits
    • Verifying that GatherClusters returns an empty result when queried with the tip txids from all 10 chains, confirming the >500 limit is hit
    • Creating a synced wallet and a transaction that spends outputs from all 10 cluster tips
    • Adding the cluster tip transactions to the wallet so AllInputsMine() recognizes the inputs, matching the realistic bumpfee RPC code path where require_mine=true
    • Calling CreateRateBumpTransaction with an explicit fee rate, which triggers CheckFeeRate -> calculateCombinedBumpFee -> MiniMiner -> GatherClusters -> nullopt -> WALLET_ERROR
    • Asserting the result is WALLET_ERROR with exactly one error containing the expected “enormous cluster of unconfirmed transactions” message

    A functional test using the bumpfee RPC is not feasible for this code path because MAX_CLUSTER_COUNT_LIMIT (64) prevents submitting a transaction to the mempool whose inputs would merge clusters totaling more than 64 transactions, making it impossible to reach the 500-tx GatherClusters limit through normal RPC operations.

  2. test: add feebumper coverage for combined bump fee calculation failure
    Add a unit test that exercises the error path in CreateRateBumpTransaction
    when calculateCombinedBumpFee() returns nullopt due to the 500-transaction
    GatherClusters DoS limit being exceeded (feebumper.cpp lines 83-87).
    
    The test works by:
    - Building 501 mempool transactions across 10 independent chains (first
      chain has 51 transactions, remaining nine have 50 each) using
      TryAddToMempool to bypass cluster policy limits
    - Verifying that GatherClusters returns an empty result when queried
      with the tip txids from all 10 chains, confirming the >500 limit is hit
    - Creating a synced wallet and a transaction that spends outputs from
      all 10 cluster tips
    - Adding the cluster tip transactions to the wallet so AllInputsMine()
      recognizes the inputs, matching the realistic bumpfee RPC code path
      where require_mine=true
    - Calling CreateRateBumpTransaction with an explicit fee rate, which
      triggers CheckFeeRate -> calculateCombinedBumpFee -> MiniMiner ->
      GatherClusters -> nullopt -> WALLET_ERROR
    - Asserting the result is WALLET_ERROR with exactly one error containing
      the expected "enormous cluster of unconfirmed transactions" message
    
    A functional test using the bumpfee RPC is not feasible for this code
    path because MAX_CLUSTER_COUNT_LIMIT (64) prevents submitting a
    transaction to the mempool whose inputs would merge clusters totaling
    more than 64 transactions, making it impossible to reach the 500-tx
    GatherClusters limit through normal RPC operations.
    2af395fefc
  3. DrahtBot added the label Tests on Mar 31, 2026
  4. DrahtBot commented at 10:41 pm on March 31, 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.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34924 (test: add feebumper coverage for combined bump fee failure by MkDev11)

    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.

  5. itdeveloper1988 commented at 10:55 pm on March 31, 2026: none
    @achow101 Can you please review the PR and let me know your feedback?
  6. maflcko commented at 6:41 am on April 1, 2026: member
    instead of creating a duplicate, it would be better to review the duplicate
  7. maflcko closed this on Apr 1, 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-05 12:13 UTC

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