1
0

network: load gossip db early

The gossip db is loaded early when the network is started to save
time when the gui is locked and a wallet not yet loaded. Side effects
of the LNWallet to start peering when a channel db is loaded is
circumvented.
This commit is contained in:
bitromortac
2020-10-08 06:36:02 +02:00
committed by ThomasV
parent 6045de759b
commit 4efcb53d24
7 changed files with 13 additions and 6 deletions

View File

@@ -460,7 +460,7 @@ class LNGossip(LNWorker):
self.has_started = True
async def maintain_db(self):
await self.channel_db.load_data()
await self.channel_db.data_loaded.wait()
while True:
if len(self.unknown_ids) == 0:
self.channel_db.prune_old_policies(self.max_age)
@@ -584,6 +584,10 @@ class LNWallet(LNWorker):
def start_network(self, network: 'Network'):
assert network
self.network = network
self.config = network.config
self.channel_db = self.network.channel_db
self.lnwatcher = LNWalletWatcher(self, network)
self.lnwatcher.start_network(network)
self.network = network
@@ -592,7 +596,6 @@ class LNWallet(LNWorker):
for chan in self.channels.values():
self.lnwatcher.add_channel(chan.funding_outpoint.to_str(), chan.get_funding_address())
super().start_network(network)
for coro in [
self.maybe_listen(),
self.lnwatcher.on_network_update('network_updated'), # shortcut (don't block) if funding tx locked and verified