pytest: make test_gossip_no_empty_announcements robust when update delayed.
In this test we tell l3 to disconnect on sending WIRE_CHANNEL_ANNOUNCEMENT. This is hit by gossipd (to disconnect from l2) but *also* channeld to disconnect from l4. That's OK, because normally by this point l4 has sent its real channel_update. However, the next patch introduces a delay in sending channel_updates, meaning l4 hasn't sent it yet. If l3 doesn't reconnect to l4, we never get the channel_update and the test which expects l1 to eventually see both sides of the channel fails. So we manually reconnect then. Note that we remove the redundant 'dev-no-reconnect' option from l2: it's added automatically as it doesn't set 'may_reconnect'. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ef59a8f4aa
commit
55a09d79b9
|
@ -2935,11 +2935,12 @@ class LightningDTests(BaseLightningDTests):
|
|||
def test_gossip_no_empty_announcements(self):
|
||||
# Need full IO logging so we can see gossip
|
||||
l1 = self.node_factory.get_node(options={'log-level': 'io'})
|
||||
l2 = self.node_factory.get_node(options={'log-level': 'io',
|
||||
'dev-no-reconnect': None})
|
||||
l2 = self.node_factory.get_node(options={'log-level': 'io'})
|
||||
# l3 sends CHANNEL_ANNOUNCEMENT to l2, but not CHANNEL_UDPATE.
|
||||
l3 = self.node_factory.get_node(disconnect=['+WIRE_CHANNEL_ANNOUNCEMENT'])
|
||||
l4 = self.node_factory.get_node()
|
||||
l3 = self.node_factory.get_node(disconnect=['+WIRE_CHANNEL_ANNOUNCEMENT'],
|
||||
options={'dev-no-reconnect': None},
|
||||
may_reconnect=True)
|
||||
l4 = self.node_factory.get_node(may_reconnect=True)
|
||||
|
||||
# Turn on IO logging for gossipds
|
||||
subprocess.run(['kill', '-USR1', l1.subd_pid('gossipd')])
|
||||
|
@ -2956,6 +2957,11 @@ class LightningDTests(BaseLightningDTests):
|
|||
# 0x0100 = channel_announcement, which goes to l2 before l3 dies.
|
||||
l2.daemon.wait_for_log('\[IN\] 0100')
|
||||
|
||||
# l3 actually disconnects from l4 *and* l2! That means we never see
|
||||
# the (delayed) channel_update from l4.
|
||||
wait_for(lambda: not l3.rpc.listpeers(l4.info['id'])['peers'][0]['connected'])
|
||||
l3.rpc.connect(l4.info['id'], 'localhost', l4.port)
|
||||
|
||||
# But it never goes to l1, as there's no channel_update.
|
||||
time.sleep(2)
|
||||
assert not l1.daemon.is_in_log('\[IN\] 0100')
|
||||
|
|
Loading…
Reference in New Issue