From c6bd87ccab9691d860bfaecf4c53da3d7d5237bf Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 24 Feb 2021 11:31:14 +1030 Subject: [PATCH] pytest: fix "bad gossip" flake in test_forward_event_notification If not all nodes are up-to-date with the new blocks, they can reject announcements: ``` lightningd-4: 2021-02-23T02:02:47.832Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: Ignoring future channel_announcment for 124x1x0 (current block 123) lightningd-4: 2021-02-23T02:02:47.848Z DEBUG lightningd: Adding block 133: 2d950451211398de9c10bf9df7eb53b385390eca31e306bc8fc1387b53d9f9a2 lightningd-4: 2021-02-23T02:02:47.865Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: Bad gossip order: WIRE_CHANNEL_UPDATE before announcement 124x1x0/0 lightningd-4: 2021-02-23T02:02:47.866Z DEBUG 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-gossipd: Bad gossip order: WIRE_CHANNEL_UPDATE before announcement 124x1x0/1 ``` Technically, this change is not sufficient either, since *gossipd* might not know about new block yet. But it makes this case less likely. Signed-off-by: Rusty Russell --- tests/test_plugin.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index bb0f635bd..57173385a 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1187,12 +1187,16 @@ def test_forward_event_notification(node_factory, bitcoind, executor): {}, {'disconnect': disconnects}]) - l1.openchannel(l2, confirm=False) - l2.openchannel(l3, confirm=False) - l2.openchannel(l4, confirm=False) - l2.openchannel(l5, confirm=False) + l1.openchannel(l2, confirm=False, wait_for_announce=False) + l2.openchannel(l3, confirm=False, wait_for_announce=False) + l2.openchannel(l4, confirm=False, wait_for_announce=False) + l2.openchannel(l5, confirm=False, wait_for_announce=False) + + # Generate 5, then make sure everyone is up to date before + # last one, otherwise they might think it's in the future! + bitcoind.generate_block(5) sync_blockheight(bitcoind, [l1, l2, l3, l4, l5]) - bitcoind.generate_block(6) + bitcoind.generate_block(1) wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 8)