From 02b413a4dc632e8f2f9513f49c510d50eda91237 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 5 Aug 2020 04:00:51 +0930 Subject: [PATCH] pytest: make join_nodes / line_graph wait for updates in both dirs. This is what fund_channel() does, which is more thorough than what we were doing. But since the order of the logs is undefined, we need to be a little careful. Signed-off-by: Rusty Russell --- contrib/pyln-testing/pyln/testing/utils.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index a12a41ac3..cfabb9cde 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -1105,9 +1105,29 @@ class NodeFactory(object): 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) + # We don't want to assume message order here. + # Wait for ends: + nodes[0].daemon.wait_for_logs([r'update for channel {}/0 now ACTIVE' + .format(scids[0]), + r'update for channel {}/1 now ACTIVE' + .format(scids[0])]) + nodes[-1].daemon.wait_for_logs([r'update for channel {}/0 now ACTIVE' + .format(scids[-1]), + r'update for channel {}/1 now ACTIVE' + .format(scids[-1])]) + # Now wait for intermediate nodes: + for i, n in enumerate(nodes[1:-1]): + n.daemon.wait_for_logs([r'update for channel {}/0 now ACTIVE' + .format(scids[i]), + r'update for channel {}/1 now ACTIVE' + .format(scids[i]), + r'update for channel {}/0 now ACTIVE' + .format(scids[i + 1]), + r'update for channel {}/1 now ACTIVE' + .format(scids[i + 1])]) + if not wait_for_announce: return