electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit f155f3aff5615cb075e7ce8c8f9beba009b1aacd
parent 5d907907263efba51d3b9531de073aa3db6c9cd9
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 22 Oct 2020 18:17:13 +0200

start lngossip if instantiated; this saves a boolean

Diffstat:
Melectrum/gui/qt/main_window.py | 2+-
Melectrum/lnworker.py | 4----
Melectrum/network.py | 7++++---
3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py @@ -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 diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -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() diff --git a/electrum/network.py b/electrum/network.py @@ -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()