diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-09-09 08:33:26 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-09-09 08:33:54 +0200 |
commit | 666eaf03cf251832302fa5d358b1a6ca128db7e8 (patch) | |
tree | 77ba58aef22802188b1fe687ffc18b5bd289e739 /qa/rpc-tests | |
parent | 80a4f21d377a8120190dd0a88be364e71607157c (diff) | |
parent | d6a5dc4a2eaa0d7348804254ca09e75fc3a858ab (diff) | |
download | bitcoin-666eaf03cf251832302fa5d358b1a6ca128db7e8.tar.xz |
Merge #8680: Address Travis spurious failures
d6a5dc4 add waitfornewblock/waitforblock/waitforblockheight rpcs and use them for tests (Cory Fields)
Diffstat (limited to 'qa/rpc-tests')
-rw-r--r-- | qa/rpc-tests/test_framework/util.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 190fa7f661..eee77f1a10 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -125,12 +125,16 @@ def sync_blocks(rpc_connections, wait=1, timeout=60): """ Wait until everybody has the same tip """ + maxheight = 0 while timeout > 0: - tips = [ x.getbestblockhash() for x in rpc_connections ] + tips = [ x.waitforblockheight(maxheight, int(wait * 1000)) for x in rpc_connections ] + heights = [ x["height"] for x in tips ] if tips == [ tips[0] ]*len(tips): return True - time.sleep(wait) + if heights == [ heights[0] ]*len(heights): #heights are the same but hashes are not + raise AssertionError("Block sync failed") timeout -= wait + maxheight = max(heights) raise AssertionError("Block sync failed") def sync_mempools(rpc_connections, wait=1, timeout=60): |