Skip to content

Commit fae9866

Browse files
author
MarcoFalke
committed
test: Fix intermittent error in mempool_reorg
1 parent e890c15 commit fae9866

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/functional/mempool_reorg.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
class MempoolCoinbaseTest(BitcoinTestFramework):
1717
def set_test_params(self):
1818
self.num_nodes = 2
19+
self.extra_args = [
20+
[
21+
'[email protected]', # immediate tx relay
22+
],
23+
[]
24+
]
1925

2026
def skip_test_if_missing_module(self):
2127
self.skip_if_no_wallet()
@@ -38,8 +44,8 @@ def run_test(self):
3844
# 3. Indirect (coinbase and child both in chain) : spend_103 and spend_103_1
3945
# Use invalidatblock to make all of the above coinbase spends invalid (immature coinbase),
4046
# and make sure the mempool code behaves correctly.
41-
b = [ self.nodes[0].getblockhash(n) for n in range(101, 105) ]
42-
coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ]
47+
b = [self.nodes[0].getblockhash(n) for n in range(101, 105)]
48+
coinbase_txids = [self.nodes[0].getblock(h)['tx'][0] for h in b]
4349
spend_101_raw = create_raw_transaction(self.nodes[0], coinbase_txids[1], node1_address, amount=49.99)
4450
spend_102_raw = create_raw_transaction(self.nodes[0], coinbase_txids[2], node0_address, amount=49.99)
4551
spend_103_raw = create_raw_transaction(self.nodes[0], coinbase_txids[3], node0_address, amount=49.99)
@@ -67,6 +73,10 @@ def run_test(self):
6773
# Broadcast and mine 103_1:
6874
spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw)
6975
last_block = self.nodes[0].generate(1)
76+
# Sync blocks, so that peer 1 gets the block before timelock_tx
77+
# Otherwise, peer 1 would put the timelock_tx in recentRejects
78+
self.sync_all()
79+
7080
# Time-locked transaction can now be spent
7181
timelock_tx_id = self.nodes[0].sendrawtransaction(timelock_tx)
7282

0 commit comments

Comments
 (0)