mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
pytest: make line_graph wait for gossip propagation if announce param is True
This is what the callers want; generalize it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -804,15 +804,27 @@ class NodeFactory(object):
|
||||
|
||||
# Confirm all channels and wait for them to become usable
|
||||
bitcoin.generate_block(1)
|
||||
scids = []
|
||||
for src, dst in connections:
|
||||
wait_for(lambda: src.channel_state(dst) == 'CHANNELD_NORMAL')
|
||||
scid = src.get_channel_scid(dst)
|
||||
src.daemon.wait_for_log(r'Received channel_update for channel {scid}\(.\) now ACTIVE'.format(scid=scid))
|
||||
scids.append(scid)
|
||||
|
||||
if not announce:
|
||||
return nodes
|
||||
|
||||
bitcoin.generate_block(5)
|
||||
|
||||
def both_dirs_ready(n, scid):
|
||||
resp = n.rpc.listchannels(scid)
|
||||
return [a['active'] for a in resp['channels']] == [True, True]
|
||||
|
||||
# Make sure everyone sees all channels: we can cheat and
|
||||
# simply check the ends (since it's a line).
|
||||
wait_for(lambda: both_dirs_ready(nodes[0], scids[-1]))
|
||||
wait_for(lambda: both_dirs_ready(nodes[-1], scids[0]))
|
||||
|
||||
return nodes
|
||||
|
||||
def killall(self, expected_successes):
|
||||
|
||||
Reference in New Issue
Block a user