#36214 test: cover cluster limits during reorgs

full analysis

https://github.com/bitcoin/bitcoin/pull/36214 · yuvicc · +233/-0 in 1 files, 1 commits · labels: Tests

Goal

  • Cover cluster mempool trimming behavior when chain reorganizations resurrect transactions
  • Verifies that oversized clusters from reconnected mempool children are brought back within limits

Adds functional tests to test/functional/mempool_cluster.py covering how cluster mempool handles transactions resurrected by a chain reorg. It tests scenarios where resurrecting transactions and reconnecting existing in-mempool children causes clusters to exceed configured count or size limits, verifying that the node evicts the worst chunks to bring clusters back within limits.

Problem: During a reorg, resurrected transactions can merge with existing unconfirmed children to form clusters exceeding limits, and this reorg-driven cluster trimming path lacked dedicated functional test coverage.

Category: Mempool and policy (#3 of 10)

P3 · test coverage

  • P3 because it adds dedicated test coverage for cluster mempool reorg dynamics
  • Verifies cluster invariants hold when block disconnects produce oversized clusters

Worthwhile functional test coverage for cluster mempool reorg dynamics. It verifies that oversized clusters resulting from block disconnects are trimmed back within count and size limits, protecting cluster invariants during chain reorganizations.

Membership: Touches test/functional/mempool_cluster.py to test cluster mempool limits and trimming during block disconnection.

Factors: security/stability 1, bug 0, performance 0, user value 0, leverage 1

Reviewability: Ready

  • Ready to review as a self-contained functional test addition

The patch is a self-contained functional test addition with passing CI and no merge conflicts.

Author status: active

Resolved concerns:

  • instagibbs noted that transaction_graph_test covers reconnecting children; yuvicc clarified that these tests specifically exercise cluster trimming when clusters become oversized only after reconnecting existing children.

Agreement: Neutral

  • Neutral sentiment with no formal ACKs posted yet
  • Questioned redundancy with existing graph tests (instagibbs)
  • Clarified novel trimming coverage when reconnected children exceed limits (yuvicc)

instagibbs questioned redundancy with existing tests; yuvicc clarified the specific trimming paths exercised.

No formal ACKs have been posted yet. A reviewer asked for clarification on what novel behavior the tests exercise relative to existing tests, and the author provided a detailed explanation.

  • instagibbs: 'I think the only thing this test adds over test_chainlimits_exceeded and transaction_graph_test is testing the pre-existing mempool children are added back in to the clusters. Thoughts?'
  • yuvicc clarified that it tests clusters becoming oversized only after reconnecting children, specifically exercising Trim() for count, size, and merged clusters.

Review verdicts (DrahtBot): 0

Files

233 lines under test/bench/ci.

  • test/functional/mempool_cluster.py +233/-0

Card

Adds functional tests to test/functional/mempool_cluster.py verifying that cluster count and size limits are respected when block reorgs resurrect transactions and reconnect them to mempool children. The test validates that the node's cluster trimming logic drops the lowest feerate chunks to restore limits. Review is ready and self-contained, with author clarification provided on how this differs from existing cluster tests.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T16:23, confidence high, input hash 8f96aa16a3ae11e4