test: consolidate mempool constants #36611

pull fanquake wants to merge 5 commits into bitcoin:master from fanquake:consolidate_testframework_mempool changing 10 files +37 −34
  1. fanquake commented at 5:01 PM on October 22, 2026: member

    Consolidate usage of mempool constants in the functional tests. As well as one instance of MAX_FUTURE_BLOCK_TIME.

  2. DrahtBot added the label Tests on Oct 22, 2026
  3. DrahtBot commented at 5:01 PM on October 22, 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.

    Type Reviewers
    ACK stickies-v, mercie-ux

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. mercie-ux commented at 4:39 AM on October 23, 2026: contributor

    ACK 4385d415eb5dbcce28051f40687cc844c5f8dfdb

    Non-blocking feature_rbf.py still defines MAX_REPLACEMENT_LIMIT = 100 and uses it in the “too many conflicting clusters” test. Since this is the same limit, could this test also import and use MAX_REPLACEMENT_CANDIDATES from mempool_util? https://github.com/bitcoin/bitcoin/blob/4385d415eb5dbcce28051f40687cc844c5f8dfdb/test/functional/feature_rbf.py#L25

  5. in test/functional/mempool_package_rbf.py:195 in 4385d415eb outdated
     190 | @@ -190,8 +191,8 @@ def test_package_rbf_additional_fees(self):
     191 |  
     192 |      def test_package_rbf_max_conflicts(self):
     193 |          node = self.nodes[0]
     194 | -        self.log.info("Check Package RBF cannot conflict with  more than MAX_REPLACEMENT_CANDIDATES clusters")
     195 | -        num_coins = 101
     196 | +        self.log.info("Check Package RBF cannot conflict with more than MAX_REPLACEMENT_CANDIDATES clusters")
     197 | +        num_coins = MAX_REPLACEMENT_CANDIDATES + 1
    


    stickies-v commented at 8:23 AM on October 23, 2026:

    nit: replace further usage of the literal:

    <details> <summary>git diff on 4385d415eb</summary>

    diff --git a/test/functional/mempool_package_rbf.py b/test/functional/mempool_package_rbf.py
    index c8f6a7c11a..6a2a011476 100755
    --- a/test/functional/mempool_package_rbf.py
    +++ b/test/functional/mempool_package_rbf.py
    @@ -196,7 +196,7 @@ class PackageRBFTest(BitcoinTestFramework):
             parent_coins = self.coins[:num_coins]
             del self.coins[:num_coins]
     
    -        # Original transactions: 101 transactions with 2 descendants each -> 303 total transactions, 101 clusters
    +        # Original transactions: num_coins transactions with 2 descendants each -> num_coins * 3 total transactions, num_coins clusters
             size_three_clusters = []
             for coin in parent_coins:
                 size_three_clusters.append(self.wallet.send_self_transfer_chain(from_node=node, chain_length=3, utxo_to_spend=coin))
    @@ -211,13 +211,13 @@ class PackageRBFTest(BitcoinTestFramework):
             parent_fee_per_conflict = 10000
             child_feerate = 10000 * DEFAULT_FEE
     
    -        # Conflict against all transactions by double-spending each parent, causing 101 cluster conflicts
    +        # Conflict against all transactions by double-spending each parent, causing num_coins cluster conflicts
             package_parent = self.wallet.create_self_transfer_multi(utxos_to_spend=parent_coins, fee_per_output=parent_fee_per_conflict)
             package_child = self.wallet.create_self_transfer(fee_rate=child_feerate, utxo_to_spend=package_parent["new_utxos"][0])
     
             pkg_results = node.submitpackage([package_parent["hex"], package_child["hex"]], maxfeerate=0)
             assert_equal("transaction failed", pkg_results["package_msg"])
    -        assert_equal(f"too many potential replacements, rejecting replacement {package_parent['txid']}; too many conflicting clusters (101 > 100)", pkg_results["tx-results"][package_parent["wtxid"]]["error"])
    +        assert_equal(f"too many potential replacements, rejecting replacement {package_parent['txid']}; too many conflicting clusters ({num_coins} > {MAX_REPLACEMENT_CANDIDATES})", pkg_results["tx-results"][package_parent["wtxid"]]["error"])
             self.assert_mempool_contents(expected=expected_txns)
     
             # Make singleton tx to conflict with in next batch
    @@ -233,7 +233,7 @@ class PackageRBFTest(BitcoinTestFramework):
             package_child = self.wallet.create_self_transfer(fee_rate=child_feerate, utxo_to_spend=package_parent["new_utxos"][0])
             pkg_results = node.submitpackage([package_parent["hex"], package_child["hex"]], maxfeerate=0)
             assert_equal("transaction failed", pkg_results["package_msg"])
    -        assert_equal(f"too many potential replacements, rejecting replacement {package_parent['txid']}; too many conflicting clusters (101 > 100)", pkg_results["tx-results"][package_parent["wtxid"]]["error"])
    +        assert_equal(f"too many potential replacements, rejecting replacement {package_parent['txid']}; too many conflicting clusters ({num_coins} > {MAX_REPLACEMENT_CANDIDATES})", pkg_results["tx-results"][package_parent["wtxid"]]["error"])
             self.assert_mempool_contents(expected=expected_txns)
     
             # Finally, conflict with MAX_REPLACEMENT_CANDIDATES clusters
    
    

    </details>

  6. in test/functional/feature_taproot.py:673 in 4385d415eb outdated
     672 | @@ -670,7 +673,6 @@ def byte_popper(expr):
     673 |  MIN_FEE = 50000
     674 |  
     675 |  TX_STANDARD_VERSIONS = [1, 2, TX_MAX_STANDARD_VERSION]
     676 | -TRUC_MAX_VSIZE = 10000 # test doesn't cover in-mempool spends, so only this limit is hit
    


    stickies-v commented at 8:26 AM on October 23, 2026:

    nit: docstring could be preserved:

    <details> <summary>git diff on 4385d415eb</summary>

    diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py
    index 7a1a2d9a6b..2cba934648 100755
    --- a/test/functional/feature_taproot.py
    +++ b/test/functional/feature_taproot.py
    @@ -1638,6 +1638,7 @@ class TaprootTest(BitcoinTestFramework):
                         fail_input is None  # Must be valid to be standard
                         and (all(utxo.spender.is_standard for utxo in input_utxos))  # All inputs must be standard
                         and tx.version in TX_STANDARD_VERSIONS # The tx version must be standard
    +                    # test doesn't cover in-mempool spends, so only TRUC_MAX_VSIZE limit is hit
                         and not (tx.version == 3 and tx.get_vsize() > TRUC_MAX_VSIZE)  # Topological standardness rules must be followed
                     )
                     msg = ','.join(utxo.spender.comment + ("*" if n == fail_input else "") for n, utxo in enumerate(input_utxos))
    
    

    </details>

  7. fanquake force-pushed on Oct 23, 2026
  8. stickies-v approved
  9. stickies-v commented at 8:39 AM on October 23, 2026: contributor

    ACK 6cbef1aa02ea1445f0a3ad9e514e98b2feca78be

  10. test: use TRUC constants from mempool_util 74570cf92a
  11. test: add MAX_REPLACEMENT_CANDIDATES to mempool_util
    Use it in feature_rbf & mempool_package_rbf.
    fb7067d898
  12. test: consolidate DEFAULT_CLUSTER_LIMIT to mempool_util 275cd98126
  13. test: move DEFAULT_ANCESTOR_LIMIT to mempool_util
    Remove unused DEFAULT_DESCENDANT_LIMIT.
    0e44700b2a
  14. test: use MAX_FUTURE_BLOCK_TIME from blocktools 9d48c8af46
  15. fanquake force-pushed on Oct 23, 2026
  16. DrahtBot added the label CI failed on Oct 23, 2026
  17. DrahtBot removed the label CI failed on Oct 23, 2026
  18. fanquake commented at 10:17 AM on October 23, 2026: member

    Took all the suggestions here.

  19. stickies-v commented at 11:19 AM on October 23, 2026: contributor

    re-ACK 9d48c8af469fa63c79a3b234bc7fe9fe3a25c288

  20. mercie-ux commented at 2:38 PM on October 23, 2026: contributor

    re-ACK 9d48c8af469fa63c79a3b234bc7fe9fe3a25c288


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-10-26 02:52 UTC

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