Skip to content

Commit 4d10d2e

Browse files
committed
Eliminate race condition in mempool_packages test
1 parent b1cf005 commit 4d10d2e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

qa/rpc-tests/mempool_packages.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,18 @@ def run_test(self):
8787
print "too-long-ancestor-chain successfully rejected"
8888

8989
# Check that prioritising a tx before it's added to the mempool works
90+
# First clear the mempool by mining a block.
9091
self.nodes[0].generate(1)
92+
sync_blocks(self.nodes)
93+
assert_equal(len(self.nodes[0].getrawmempool()), 0)
94+
# Prioritise a transaction that has been mined, then add it back to the
95+
# mempool by using invalidateblock.
9196
self.nodes[0].prioritisetransaction(chain[-1], 0, 2000)
9297
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
98+
# Keep node1's tip synced with node0
99+
self.nodes[1].invalidateblock(self.nodes[1].getbestblockhash())
100+
101+
# Now check that the transaction is in the mempool, with the right modified fee
93102
mempool = self.nodes[0].getrawmempool(True)
94103

95104
descendant_fees = 0

0 commit comments

Comments
 (0)