gossip: Disable local channels after loading the gossip_store

We don't have any connection yet, so how could they be active? Disable both
sides to avoid trying to route through them or telling others to use them as
`contact_points` in invoices.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-05-28 19:10:25 +02:00
committed by Rusty Russell
parent f2dc406172
commit c17848a3f3
3 changed files with 73 additions and 5 deletions

View File

@@ -2505,10 +2505,10 @@ class LightningDTests(BaseLightningDTests):
too.
"""
opts = {'dev-no-reconnect': None}
l1 = self.node_factory.get_node(options=opts)
l2 = self.node_factory.get_node(options=opts)
l3 = self.node_factory.get_node(options=opts)
l4 = self.node_factory.get_node(options=opts)
l1 = self.node_factory.get_node(options=opts, may_reconnect=True)
l2 = self.node_factory.get_node(options=opts, may_reconnect=True)
l3 = self.node_factory.get_node(options=opts, may_reconnect=True)
l4 = self.node_factory.get_node(options=opts, may_reconnect=True)
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
@@ -2532,8 +2532,14 @@ class LightningDTests(BaseLightningDTests):
wait_for(lambda: count_active(l2) == 4)
wait_for(lambda: count_active(l3) == 6) # 4 public + 2 local
# l1 restarts and doesn't connect, but loads from persisted store
# l1 restarts and doesn't connect, but loads from persisted store, all
# local channels should be disabled, leaving only the two l2 <-> l3
# directions
l1.restart()
wait_for(lambda: count_active(l1) == 2)
# Now reconnect, they should re-enable the two l1 <-> l2 directions
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
wait_for(lambda: count_active(l1) == 4)
# Now spend the funding tx, generate a block and see others deleting the
@@ -2563,6 +2569,8 @@ class LightningDTests(BaseLightningDTests):
# Finally, it should also remember the deletion after a restart
l3.restart()
l4.restart()
l2.rpc.connect(l3.info['id'], 'localhost', l3.port)
l3.rpc.connect(l4.info['id'], 'localhost', l4.port)
wait_for(lambda: count_active(l3) == 4) # 2 public + 2 local
# Both l3 and l4 should remember their local-only channel