Move node restart in test to better place.

Needed because the previous test used -persistmempool=0 and we need to
forget about the transaction it created.

Credit: Sjors Provoost
This commit is contained in:
Peter Todd 2025-04-28 20:16:50 +00:00
parent b420376aef
commit 47f9565c15
No known key found for this signature in database
GPG key ID: 2E5CB5D535512F37

View file

@ -186,6 +186,9 @@ class MiningTest(BitcoinTestFramework):
assert tx_below_min_feerate['txid'] not in block_template_txids assert tx_below_min_feerate['txid'] not in block_template_txids
assert tx_below_min_feerate['txid'] not in block_txids assert tx_below_min_feerate['txid'] not in block_txids
# Restart node to clear mempool for the next test
self.restart_node(0)
def test_timewarp(self): def test_timewarp(self):
self.log.info("Test timewarp attack mitigation (BIP94)") self.log.info("Test timewarp attack mitigation (BIP94)")
node = self.nodes[0] node = self.nodes[0]
@ -279,11 +282,9 @@ class MiningTest(BitcoinTestFramework):
def test_block_max_weight(self): def test_block_max_weight(self):
self.log.info("Testing default and custom -blockmaxweight startup options.") self.log.info("Testing default and custom -blockmaxweight startup options.")
# Restart the node
LARGE_TXS_COUNT = 10 LARGE_TXS_COUNT = 10
LARGE_VSIZE = int(((MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT) / WITNESS_SCALE_FACTOR) / LARGE_TXS_COUNT) LARGE_VSIZE = int(((MAX_BLOCK_WEIGHT - DEFAULT_BLOCK_RESERVED_WEIGHT) / WITNESS_SCALE_FACTOR) / LARGE_TXS_COUNT)
HIGH_FEERATE = Decimal("0.0003") HIGH_FEERATE = Decimal("0.0003")
self.restart_node(0)
# Ensure the mempool is empty # Ensure the mempool is empty
assert_equal(len(self.nodes[0].getrawmempool()), 0) assert_equal(len(self.nodes[0].getrawmempool()), 0)