def test_policy_rejection_types(self):
"""Test that each policy rejection type adds transactions to extra pool."""
self.log.info("Testing policy rejection types for extra pool...")
self.restart_node_with_limit(count=100)
rejection_types = ["dust", "low_fee", "op_return_size", "nonstandard_script"]
rejected_txs = []
for rejection_type in rejection_types:
self.log.info(f"Testing {rejection_type} rejection...")
tx_info = self.create_policy_rejected_tx(rejection_type)
tx_obj = tx_from_hex(tx_info['hex'])
self.segwit_node.send_message(msg_tx(tx_obj))
rejected_txs.append({
'type': rejection_type,
'tx_info': tx_info,
'txid': tx_info['tx'].hash,
'wtxid': tx_info['tx'].getwtxid()
})
self.segwit_node.sync_with_ping()
mempool = self.nodes[0].getrawmempool()
for rejected in rejected_txs:
assert_equal(rejected['txid'] in mempool, False)
self.log.info(f"✓ {rejected['type']} transaction rejected from mempool")
indices = list(range(len(rejected_txs)))
tx_list = [r['tx_info'] for r in rejected_txs]
result = self.send_compact_block(tx_list, indices)
assert_equal(result["missing_indices"], [])
self.log.info("✓ All rejected transactions are available in extra pool")
def test_extratxnpool_disabled(self):
"""Test that setting count to 0 disables the extra transaction pool."""
self.log.info("Testing disabled extra transaction pool (0 capacity)...")
self.restart_node_with_limit(count=0)
buffersize = 5
rejected_txs = self.populate_extra_pool(buffersize)
indices = list(range(buffersize))
result = self.send_compact_block(rejected_txs, indices)
assert_equal(result["missing_indices"], indices)
self.log.info(f"✓ All {buffersize} transactions are missing (extra txn pool disabled)")
These functional tests prove that extra pool helps in compact block reconstruction. With the increased limit for blockreconstructionextratxn
and addition of blockreconstructionextratxnsize
in v29.1, 20-40% rejected transactions can be cached in memory and used for block reconstruction.
Note: Extra pool evictions follow FIFO and it stores rejected transactions. So, an attacker can fill the extra pool with irrelevant transactions at no cost. It will affect the memory usage and compact block reconstruction.