Browse Source

[qa] Avoid 2 list comprehensions in sync_blocks

0.14
Russell Yanofsky 8 years ago
parent
commit
7943b13ab3
  1. 4
      qa/rpc-tests/test_framework/util.py

4
qa/rpc-tests/test_framework/util.py

@ -134,9 +134,9 @@ def sync_blocks(rpc_connections, *, wait=1, timeout=60):
while cur_time <= start_time + timeout: while cur_time <= start_time + timeout:
tips = [r.waitforblockheight(maxheight, int(wait * 1000)) for r in rpc_connections] tips = [r.waitforblockheight(maxheight, int(wait * 1000)) for r in rpc_connections]
heights = [t["height"] for t in tips] heights = [t["height"] for t in tips]
if tips == [tips[0]] * len(tips): if all(t == tips[0] for t in tips):
return return
if heights == [heights[0]] * len(heights): if all(h == heights[0] for h in heights):
raise AssertionError("Block sync failed, mismatched block hashes:{}".format( raise AssertionError("Block sync failed, mismatched block hashes:{}".format(
"".join("\n {!r}".format(tip) for tip in tips))) "".join("\n {!r}".format(tip) for tip in tips)))
maxheight = max(heights) maxheight = max(heights)

Loading…
Cancel
Save