Skip to content

Commit feaa552

Browse files
committed
Merge #421: QA: feature_fedpeg.py: Remove re-implementation of sync_all
9b030c1 QA: feature_fedpeg.py: Remove re-implementation of sync_all (Jorge Timón)
2 parents 98ff65a + 9b030c1 commit feaa552

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

qa/rpc-tests/feature_fedpeg.py

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@
1616
stop_node,
1717
)
1818

19-
# Sync mempool, make a block, sync blocks
20-
def sync_all(sidechain, sidechain2, makeblock=True):
21-
block = ""
22-
timeout = 20
23-
while len(sidechain.getrawmempool()) != len(sidechain2.getrawmempool()):
24-
time.sleep(1)
25-
timeout -= 1
26-
if timeout == 0:
27-
raise Exception("Peg-in has failed to propagate.")
28-
if makeblock:
29-
block = sidechain2.generate(1)
30-
while sidechain.getblockcount() != sidechain2.getblockcount():
31-
time.sleep(1)
32-
timeout -= 1
33-
if timeout == 0:
34-
raise Exception("Blocks are not propagating.")
35-
return block
36-
3719
def get_new_unconfidential_address(node):
3820
addr = node.getnewaddress()
3921
val_addr = node.validateaddress(addr)
@@ -158,7 +140,7 @@ def run_test(self):
158140
parent.generate(1)
159141
time.sleep(2)
160142
proof = parent.gettxoutproof([txid1])
161-
143+
162144
raw = parent.getrawtransaction(txid1)
163145
print('raw', parent.getrawtransaction(txid1, True))
164146

@@ -202,8 +184,9 @@ def run_test(self):
202184
pegtxid1 = sidechain.claimpegin(raw, proof)
203185

204186
# Will invalidate the block that confirms this transaction later
205-
sync_all(parent, parent2)
206-
blockhash = sync_all(sidechain, sidechain2)
187+
self.sync_all()
188+
blockhash = sidechain2.generate(1)
189+
self.sync_all()
207190
sidechain.generate(5)
208191

209192
tx1 = sidechain.gettransaction(pegtxid1)
@@ -252,9 +235,7 @@ def run_test(self):
252235
raw = parent.getrawtransaction(txid)
253236
pegtxs += [sidechain.claimpegin(raw, proof)]
254237

255-
sync_all(parent, parent2)
256-
sync_all(sidechain, sidechain2)
257-
238+
self.sync_all()
258239
sidechain2.generate(1)
259240
for pegtxid in pegtxs:
260241
tx = sidechain.gettransaction(pegtxid)
@@ -324,7 +305,7 @@ def run_test(self):
324305
# Don't make a block, race condition when pegin-invalid block
325306
# is awaiting further validation, nodes reject subsequent blocks
326307
# even ones they create
327-
sync_all(sidechain, sidechain2, makeblock=False)
308+
self.sync_all()
328309
print("Now send funds out in two stages, partial, and full")
329310
some_btc_addr = get_new_unconfidential_address(parent)
330311
bal_1 = sidechain.getwalletinfo()["balance"]["bitcoin"]

0 commit comments

Comments
 (0)