diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index 43bc5585e..e5fda06e6 100644 --- 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 index 33fac6de9..adaa545d5 100644 --- 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 index 39c62c294..e13552799 100644 --- 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 index ebd4c6082..fde0ae8be 100644 --- 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