mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 09:21:39 +00:00
start lngossip if instantiated; this saves a boolean
This commit is contained in:
parent
5d90790726
commit
f155f3aff5
3 changed files with 5 additions and 8 deletions
|
@ -2193,7 +2193,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||
def update_lightning_icon(self):
|
||||
if self.lightning_button is None:
|
||||
return
|
||||
if not self.network.lngossip.has_started:
|
||||
if self.network.lngossip is None:
|
||||
return
|
||||
|
||||
# display colorful lightning icon to signal connection
|
||||
|
|
|
@ -449,15 +449,11 @@ class LNGossip(LNWorker):
|
|||
self.features |= LnFeatures.GOSSIP_QUERIES_OPT
|
||||
self.features |= LnFeatures.GOSSIP_QUERIES_REQ
|
||||
self.unknown_ids = set()
|
||||
self.has_started = False
|
||||
|
||||
def start_network(self, network: 'Network'):
|
||||
assert network
|
||||
if self.has_started:
|
||||
return
|
||||
super().start_network(network)
|
||||
asyncio.run_coroutine_threadsafe(self.taskgroup.spawn(self.maintain_db()), self.network.asyncio_loop)
|
||||
self.has_started = True
|
||||
|
||||
async def maintain_db(self):
|
||||
await self.channel_db.data_loaded.wait()
|
||||
|
|
|
@ -349,15 +349,16 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
|
|||
|
||||
def maybe_init_lightning(self):
|
||||
if self.channel_db is None:
|
||||
from . import lnworker
|
||||
from . import lnrouter
|
||||
from . import channel_db
|
||||
self.channel_db = channel_db.ChannelDB(self)
|
||||
self.path_finder = lnrouter.LNPathFinder(self.channel_db)
|
||||
self.lngossip = lnworker.LNGossip()
|
||||
|
||||
def start_gossip(self):
|
||||
self.lngossip.start_network(self)
|
||||
if self.lngossip is None:
|
||||
from . import lnworker
|
||||
self.lngossip = lnworker.LNGossip()
|
||||
self.lngossip.start_network(self)
|
||||
|
||||
def stop_gossip(self):
|
||||
self.lngossip.stop()
|
||||
|
|
Loading…
Add table
Reference in a new issue