mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
functional_tests: rewrite mining code, clearer timeout info
This commit is contained in:
parent
94b5378a3b
commit
80a21da5ba
1 changed files with 11 additions and 12 deletions
|
@ -95,20 +95,19 @@ class MiningTest():
|
||||||
assert res_status.block_reward >= 600000000000
|
assert res_status.block_reward >= 600000000000
|
||||||
|
|
||||||
# wait till we mined a few of them
|
# wait till we mined a few of them
|
||||||
|
target_height = prev_height + 5
|
||||||
|
height = prev_height
|
||||||
timeout = 60 # randomx is slow to init
|
timeout = 60 # randomx is slow to init
|
||||||
timeout_height = prev_height
|
while height < target_height:
|
||||||
while True:
|
seen_height = height
|
||||||
time.sleep(1)
|
for _ in range(timeout):
|
||||||
res_info = daemon.get_info()
|
time.sleep(1)
|
||||||
height = res_info.height
|
height = daemon.get_info().height
|
||||||
if height >= prev_height + 5:
|
if height > seen_height:
|
||||||
break
|
break
|
||||||
if height > timeout_height:
|
|
||||||
timeout = 5
|
|
||||||
timeout_height = height
|
|
||||||
else:
|
else:
|
||||||
timeout -= 1
|
assert False, 'Failed to mine successor to block %d (initial block = %d)' % (seen_height, prev_height)
|
||||||
assert timeout >= 0
|
timeout = 5
|
||||||
|
|
||||||
if via_daemon:
|
if via_daemon:
|
||||||
res = daemon.stop_mining()
|
res = daemon.stop_mining()
|
||||||
|
|
Loading…
Reference in a new issue