Skip to content

Commit 9ddfce6

Browse files
author
MarcoFalke
committed
Merge #18753: test: Fix intermittent failure in wallet_importmulti
fa8b9b5 test: Fix intermittent failure in wallet_importmulti (MarcoFalke) Pull request description: The wallet is async, so after generating a block, we must call `syncwithvalidationinterfacequeue`. Otherwise the timestamp will be of the previous block. https://travis-ci.org/github/bitcoin/bitcoin/jobs/677685073#L2648 ACKs for top commit: promag: ACK fa8b9b5. Tree-SHA512: c21f9912aabbe22019d4ac9d0da06d6e46ef7f2a84d2781110e04c9836eb0ecf90a22cf2bae7f608be611670d17b20600135d1c5e5404aa1e762839816285fb4
2 parents 3cf464d + fa8b9b5 commit 9ddfce6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/functional/wallet_importmulti.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
test_address,
3333
)
3434

35+
3536
class ImportMultiTest(BitcoinTestFramework):
3637
def set_test_params(self):
3738
self.num_nodes = 2
@@ -51,7 +52,7 @@ def test_importmulti(self, req, success, error_code=None, error_message=None, wa
5152
result = self.nodes[1].importmulti([req])
5253
observed_warnings = []
5354
if 'warnings' in result[0]:
54-
observed_warnings = result[0]['warnings']
55+
observed_warnings = result[0]['warnings']
5556
assert_equal("\n".join(sorted(warnings)), "\n".join(sorted(observed_warnings)))
5657
assert_equal(result[0]['success'], success)
5758
if error_code is not None:
@@ -63,6 +64,7 @@ def run_test(self):
6364
self.nodes[0].generate(1)
6465
self.nodes[1].generate(1)
6566
timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']
67+
self.nodes[1].syncwithvalidationinterfacequeue()
6668

6769
node0_address1 = self.nodes[0].getaddressinfo(self.nodes[0].getnewaddress())
6870

@@ -257,6 +259,7 @@ def run_test(self):
257259
self.nodes[1].sendtoaddress(multisig.p2sh_addr, 10.00)
258260
self.nodes[1].generate(1)
259261
timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']
262+
self.nodes[1].syncwithvalidationinterfacequeue()
260263

261264
self.log.info("Should import a p2sh")
262265
self.test_importmulti({"scriptPubKey": {"address": multisig.p2sh_addr},
@@ -277,6 +280,7 @@ def run_test(self):
277280
self.nodes[1].sendtoaddress(multisig.p2sh_addr, 10.00)
278281
self.nodes[1].generate(1)
279282
timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']
283+
self.nodes[1].syncwithvalidationinterfacequeue()
280284

281285
self.log.info("Should import a p2sh with respective redeem script")
282286
self.test_importmulti({"scriptPubKey": {"address": multisig.p2sh_addr},
@@ -297,6 +301,7 @@ def run_test(self):
297301
self.nodes[1].sendtoaddress(multisig.p2sh_addr, 10.00)
298302
self.nodes[1].generate(1)
299303
timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']
304+
self.nodes[1].syncwithvalidationinterfacequeue()
300305

301306
self.log.info("Should import a p2sh with respective redeem script and private keys")
302307
self.test_importmulti({"scriptPubKey": {"address": multisig.p2sh_addr},
@@ -322,6 +327,7 @@ def run_test(self):
322327
self.nodes[1].sendtoaddress(multisig.p2sh_addr, 10.00)
323328
self.nodes[1].generate(1)
324329
timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime']
330+
self.nodes[1].syncwithvalidationinterfacequeue()
325331

326332
self.log.info("Should import a p2sh with respective redeem script and private keys")
327333
self.test_importmulti({"scriptPubKey": {"address": multisig.p2sh_addr},
@@ -851,5 +857,6 @@ def run_test(self):
851857
addr = wrpc.getnewaddress('', 'bech32')
852858
assert_equal(addr, addresses[i])
853859

860+
854861
if __name__ == '__main__':
855862
ImportMultiTest().main()

0 commit comments

Comments
 (0)