aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/test_framework/util.py
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-08-26 23:05:26 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-08-26 23:06:09 +0200
commit5805ac836c5847bc54cbef3e71154d022ca18eda (patch)
treeffc29daad2dbdc6c77229b680968558acc26d71e /qa/rpc-tests/test_framework/util.py
parent5127c4f21ca3f092b3a853833631dfc7f9c9456b (diff)
downloadbitcoin-5805ac836c5847bc54cbef3e71154d022ca18eda.tar.xz
Add preciousblock tests
Rebased, improved and extended by Luke-Jr.
Diffstat (limited to 'qa/rpc-tests/test_framework/util.py')
-rw-r--r--qa/rpc-tests/test_framework/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py
index 190fa7f661..bc0b801ff4 100644
--- a/qa/rpc-tests/test_framework/util.py
+++ b/qa/rpc-tests/test_framework/util.py
@@ -133,6 +133,16 @@ def sync_blocks(rpc_connections, wait=1, timeout=60):
timeout -= wait
raise AssertionError("Block sync failed")
+def sync_chain(rpc_connections, wait=1):
+ """
+ Wait until everybody has the same best block
+ """
+ while True:
+ counts = [ x.getbestblockhash() for x in rpc_connections ]
+ if counts == [ counts[0] ]*len(counts):
+ break
+ time.sleep(wait)
+
def sync_mempools(rpc_connections, wait=1, timeout=60):
"""
Wait until everybody has the same transactions in their memory