Skip to content

Commit

Permalink
Wait for nodes to sync masternode data during p2p-fullblocktest
Browse files Browse the repository at this point in the history
  • Loading branch information
tgflynn committed Aug 19, 2016
1 parent 794b90d commit a9ddf6f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions qa/rpc-tests/invalidblockrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def run_test(self):
self.tip = None
self.block_time = None
NetworkThread().start() # Start up network handling in another thread
sync_masternodes(self.nodes)
test.run()

def get_tests(self):
Expand Down
1 change: 1 addition & 0 deletions qa/rpc-tests/p2p-fullblocktest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def run_test(self):
test = TestManager(self, self.options.tmpdir)
test.add_all_connections(self.nodes)
NetworkThread().start() # Start up network handling in another thread
sync_masternodes(self.nodes)
test.run()

def add_transactions_to_block(self, block, tx_list):
Expand Down
13 changes: 13 additions & 0 deletions qa/rpc-tests/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def get_rpc_proxy(url, node_number, timeout=None):

return coverage.AuthServiceProxyWrapper(proxy, coverage_logfile)

def get_mnsync_status(node):
result = node.mnsync("status")
return result['IsSynced']

def wait_to_sync(node):
synced = False
while not synced:
synced = get_mnsync_status(node)
time.sleep(0.5)

def p2p_port(n):
return 11000 + n + os.getpid()%999
Expand Down Expand Up @@ -96,6 +105,10 @@ def sync_mempools(rpc_connections, wait=1):
break
time.sleep(wait)

def sync_masternodes(rpc_connections):
for node in rpc_connections:
wait_to_sync(node)

bitcoind_processes = {}

def initialize_datadir(dirname, n):
Expand Down

0 comments on commit a9ddf6f

Please sign in to comment.