commit 0d160cceead9ba70080fe3f19b47c90490fc26d3
parent 8eaf0004e1bc78740b95f0daa2a0512a5ca2fe12
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 6 Mar 2020 11:23:26 +0100
Qt: test if lightinng is running
Diffstat:
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py
@@ -206,6 +206,8 @@ class ElectrumGui(Logger):
self.app.new_window_signal.emit(path, uri)
def show_lightning_dialog(self):
+ if not self.daemon.network.is_lightning_running():
+ return
if not self.lightning_dialog:
self.lightning_dialog = LightningDialog(self)
self.lightning_dialog.bring_to_top()
diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py
@@ -66,8 +66,11 @@ class ChannelsList(MyTreeView):
labels[subject] = label
status = self.lnworker.get_channel_status(chan)
closed = chan.is_closed()
- node_info = self.lnworker.channel_db.get_node_info_for_node_id(chan.node_id)
- node_alias = (node_info.alias if node_info else '') or ''
+ if self.parent.network.is_lightning_running():
+ node_info = self.lnworker.channel_db.get_node_info_for_node_id(chan.node_id)
+ node_alias = (node_info.alias if node_info else '') or ''
+ else:
+ node_alias = ''
return [
format_short_channel_id(chan.short_channel_id),
bh2u(chan.node_id),
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
@@ -2076,6 +2076,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
def update_lightning_icon(self):
if self.lightning_button is None:
return
+ if not self.network.is_lightning_running():
+ return
cur, total = self.network.lngossip.get_sync_progress_estimate()
# self.logger.debug(f"updating lngossip sync progress estimate: cur={cur}, total={total}")
progress_percent = 0
diff --git a/electrum/network.py b/electrum/network.py
@@ -322,6 +322,9 @@ class Network(Logger):
self.local_watchtower.start_network(self)
asyncio.ensure_future(self.local_watchtower.start_watching())
+ def is_lightning_running(self):
+ return self.channel_db is not None
+
def maybe_init_lightning(self):
if self.channel_db is None:
from . import lnworker