Add test case for cluster size limits to TRUC logic
What changed, and why it matters
This commit only adds a new test case to Bitcoin Core's test suite. It checks that existing mempool cluster-size and cluster-count limits also apply to TRUC (version 3) transactions. There is no code change to the actual Bitcoin Core node software, so it cannot directly introduce, fix, or exploit a security issue in running nodes.
No action required. Review as ordinary test-coverage improvement. If investigating a broader TRUC/cluster-limit issue, look for related commits that change the actual mempool policy implementation rather than tests.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds 13 lines to test/functional/mempool_truc.py. It restarts a test node with -limitclustersize=10 and later -limitclustercount=1, then verifies that sending a TRUC child whose parent already occupies most of the cluster budget is rejected with ‘too-large-cluster’ (RPC error -26). This is purely test coverage for already-implemented policy behavior; no consensus, networking, or mempool logic is modified.
Changed components
test/functional/mempool_truc.pyInspect captured patch +13 / −0
diff --git a/test/functional/mempool_truc.py b/test/functional/mempool_truc.py
index 70b9d0e2..687b7072 100755
--- a/test/functional/mempool_truc.py
+++ b/test/functional/mempool_truc.py
@@ -228,6 +228,19 @@ class MempoolTRUC(BitcoinTestFramework):
assert_equal(node.getmempoolentry(tx_v3_parent_large1["txid"])["descendantcount"], 1)
self.generate(node, 1)
+ self.log.info("Test that a decreased limitclustersize also applies to TRUC child")
+ self.restart_node(0, extra_args=["-limitclustersize=10", "-acceptnonstdtxn=1"])
+ tx_v3_parent_large2 = self.wallet.send_self_transfer(from_node=node, target_vsize=parent_target_vsize, version=3)
+ tx_v3_child_large2 = self.wallet.create_self_transfer(utxo_to_spend=tx_v3_parent_large2["new_utxo"], target_vsize=child_target_vsize, version=3)
+ # Parent and child are within TRUC limits
+ assert_greater_than_or_equal(TRUC_MAX_VSIZE, tx_v3_parent_large2["tx"].get_vsize())
+ assert_greater_than_or_equal(TRUC_CHILD_MAX_VSIZE, tx_v3_child_large2["tx"].get_vsize())
+ assert_raises_rpc_error(-26, "too-large-cluster", node.sendrawtransaction, tx_v3_child_large2["hex"])
+ self.log.info("Test that a decreased limitclustercount also applies to TRUC transactions")
+ self.restart_node(0, extra_args=["-limitclustercount=1", "-acceptnonstdtxn=1"])
+ assert_raises_rpc_error(-26, "too-large-cluster", node.sendrawtransaction, tx_v3_child_large2["hex"])
+ self.check_mempool([tx_v3_parent_large2["txid"]])
+
@cleanup()
def test_truc_ancestors_package(self):
self.log.info("Test that TRUC ancestor limits are checked within the package")
Why this scored 12/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.