[test] rework/delete feature_rbf tests requiring large clusters
What changed, and why it matters
This commit only changes Bitcoin Core's functional test suite. It reworks and deletes some Replace-By-Fee (RBF) tests that previously needed very large transaction clusters. The production mempool rules are not modified, and no security vulnerability is present in the commit.
No security action required. Review as ordinary test cleanup if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies test/functional/feature_rbf.py. It tightens test mempool limits (limitancestorcount/limitdescendantcount from 50/200 to 64/64, removes size limits), caps a chain-building loop with MAX_CLUSTER_LIMIT, removes a test case that intentionally exceeded the ‘too many potential replacements’ anti-DoS limit, and adds a block generation step before spending split outputs. These are test-maintenance changes; no consensus, P2P, or mempool policy code is touched.
Changed components
test/functional/feature_rbf.pyInspect captured patch +7 / −24
diff --git a/test/functional/feature_rbf.py b/test/functional/feature_rbf.py
index 91d90efe..91a79113 100755
--- a/test/functional/feature_rbf.py
+++ b/test/functional/feature_rbf.py
@@ -28,10 +28,8 @@ class ReplaceByFeeTest(BitcoinTestFramework):
self.num_nodes = 2
self.extra_args = [
[
- "-limitancestorcount=50",
- "-limitancestorsize=101",
- "-limitdescendantcount=200",
- "-limitdescendantsize=101",
+ "-limitancestorcount=64",
+ "-limitdescendantcount=64",
],
# second node has default mempool parameters
[
@@ -145,7 +143,9 @@ class ReplaceByFeeTest(BitcoinTestFramework):
prevout = tx0_outpoint
remaining_value = initial_nValue
chain_txids = []
- while remaining_value > 1 * COIN:
+ for _ in range(MAX_CLUSTER_LIMIT):
+ if remaining_value <= 1 * COIN:
+ break
remaining_value -= int(0.1 * COIN)
prevout = self.wallet.send_self_transfer(
from_node=self.nodes[0],
@@ -244,25 +244,6 @@ class ReplaceByFeeTest(BitcoinTestFramework):
for txid in tree_txs:
assert txid not in mempool
- # Try again, but with more total transactions than the "max txs
- # double-spent at once" anti-DoS limit.
- for n in (MAX_REPLACEMENT_LIMIT + 1, MAX_REPLACEMENT_LIMIT * 2):
- fee = int(0.00001 * COIN)
- tx0_outpoint = self.make_utxo(self.nodes[0], initial_nValue)
- tree_txs = list(branch(tx0_outpoint, initial_nValue, n, fee=fee))
- assert_equal(len(tree_txs), n)
-
- dbl_tx_hex = self.wallet.create_self_transfer(
- utxo_to_spend=tx0_outpoint,
- sequence=0,
- fee=2 * (Decimal(fee) / COIN) * n,
- )["hex"]
- # This will raise an exception
- assert_raises_rpc_error(-26, "too many potential replacements", self.nodes[0].sendrawtransaction, dbl_tx_hex, 0)
-
- for txid in tree_txs:
- self.nodes[0].getrawtransaction(txid)
-
def test_replacement_feeperkb(self):
"""Replacement requires fee-per-KB to be higher"""
tx0_outpoint = self.make_utxo(self.nodes[0], int(1.1 * COIN))
@@ -380,6 +361,8 @@ class ReplaceByFeeTest(BitcoinTestFramework):
amount_per_output=split_value,
)["new_utxos"]
+ self.generate(self.nodes[0], 1)
+
# Now spend each of those outputs individually
for utxo in splitting_tx_utxos:
self.wallet.send_self_transfer(
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.