Skip to content

Commit c96b2e4

Browse files
committed
qa: Fix replace-by-fee race condition failures
1 parent ff92fbf commit c96b2e4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/functional/replace-by-fee.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def set_test_params(self):
7272
["-mempoolreplacement=0"]]
7373

7474
def run_test(self):
75+
# Leave IBD and ensure nodes are synced
76+
self.nodes[0].generate(1)
77+
self.sync_all()
78+
7579
make_utxo(self.nodes[0], 1*COIN)
7680

7781
self.log.info("Running test simple doublespend...")
@@ -110,13 +114,18 @@ def test_simple_doublespend(self):
110114
"""Simple doublespend"""
111115
tx0_outpoint = make_utxo(self.nodes[0], int(1.1*COIN))
112116

117+
# make_utxo may have generated a bunch of blocks, so we need to sync
118+
# before we can spend the coins generated, or else the resulting
119+
# transactions might not be accepted by our peers.
120+
self.sync_all()
121+
113122
tx1a = CTransaction()
114123
tx1a.vin = [CTxIn(tx0_outpoint, nSequence=0)]
115124
tx1a.vout = [CTxOut(1*COIN, CScript([b'a']))]
116125
tx1a_hex = txToHex(tx1a)
117126
tx1a_txid = self.nodes[0].sendrawtransaction(tx1a_hex, True)
118127

119-
self.sync_all([self.nodes])
128+
self.sync_all()
120129

121130
# Should fail because we haven't changed the fee
122131
tx1b = CTransaction()

0 commit comments

Comments
 (0)