mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 17:55:20 +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):
|
def update_lightning_icon(self):
|
||||||
if self.lightning_button is None:
|
if self.lightning_button is None:
|
||||||
return
|
return
|
||||||
if not self.network.lngossip.has_started:
|
if self.network.lngossip is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# display colorful lightning icon to signal connection
|
# 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_OPT
|
||||||
self.features |= LnFeatures.GOSSIP_QUERIES_REQ
|
self.features |= LnFeatures.GOSSIP_QUERIES_REQ
|
||||||
self.unknown_ids = set()
|
self.unknown_ids = set()
|
||||||
self.has_started = False
|
|
||||||
|
|
||||||
def start_network(self, network: 'Network'):
|
def start_network(self, network: 'Network'):
|
||||||
assert network
|
assert network
|
||||||
if self.has_started:
|
|
||||||
return
|
|
||||||
super().start_network(network)
|
super().start_network(network)
|
||||||
asyncio.run_coroutine_threadsafe(self.taskgroup.spawn(self.maintain_db()), self.network.asyncio_loop)
|
asyncio.run_coroutine_threadsafe(self.taskgroup.spawn(self.maintain_db()), self.network.asyncio_loop)
|
||||||
self.has_started = True
|
|
||||||
|
|
||||||
async def maintain_db(self):
|
async def maintain_db(self):
|
||||||
await self.channel_db.data_loaded.wait()
|
await self.channel_db.data_loaded.wait()
|
||||||
|
|
|
@ -349,15 +349,16 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
|
||||||
|
|
||||||
def maybe_init_lightning(self):
|
def maybe_init_lightning(self):
|
||||||
if self.channel_db is None:
|
if self.channel_db is None:
|
||||||
from . import lnworker
|
|
||||||
from . import lnrouter
|
from . import lnrouter
|
||||||
from . import channel_db
|
from . import channel_db
|
||||||
self.channel_db = channel_db.ChannelDB(self)
|
self.channel_db = channel_db.ChannelDB(self)
|
||||||
self.path_finder = lnrouter.LNPathFinder(self.channel_db)
|
self.path_finder = lnrouter.LNPathFinder(self.channel_db)
|
||||||
self.lngossip = lnworker.LNGossip()
|
|
||||||
|
|
||||||
def start_gossip(self):
|
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):
|
def stop_gossip(self):
|
||||||
self.lngossip.stop()
|
self.lngossip.stop()
|
||||||
|
|
Loading…
Add table
Reference in a new issue