txgraph: use fallback order to sort chunks (feature)

This makes TxGraph also use the fallback order to decide the order of
chunks from distinct clusters.

The order of chunks across clusters becomes:
1. Feerate (high to low)
2. Equal-feerate-chunk-prefix (small to large)
3. Max-txid (chunk with lowest maximum-txid first)

This makes the full TxGraph ordering fully deterministic as long as all
clusters in it are optimally linearized.
This commit is contained in:
Pieter Wuille
2026-01-10 23:28:14 -05:00
parent 0a3351947e
commit 6f113cb184
3 changed files with 97 additions and 16 deletions

View File

@@ -239,9 +239,9 @@ class MempoolPackagesTest(BitcoinTestFramework):
self.generate(self.nodes[0], 1)
self.trigger_reorg(fork_blocks, self.nodes[0])
# Check if the txs are returned to the mempool (though the transaction ordering may
# change as it is non-deterministic).
assert_equal(set(self.nodes[0].getrawmempool()), set(mempool0))
# Check that the txs are returned to the mempool, and that transaction ordering is
# unchanged, as it is deterministic.
assert_equal(self.nodes[0].getrawmempool(), mempool0)
# Clean-up the mempool
self.generate(self.nodes[0], 1)