mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 17:01:34 +00:00
Qt: test if lightinng is running
This commit is contained in:
parent
8eaf0004e1
commit
0d160cceea
4 changed files with 12 additions and 2 deletions
|
@ -206,6 +206,8 @@ class ElectrumGui(Logger):
|
||||||
self.app.new_window_signal.emit(path, uri)
|
self.app.new_window_signal.emit(path, uri)
|
||||||
|
|
||||||
def show_lightning_dialog(self):
|
def show_lightning_dialog(self):
|
||||||
|
if not self.daemon.network.is_lightning_running():
|
||||||
|
return
|
||||||
if not self.lightning_dialog:
|
if not self.lightning_dialog:
|
||||||
self.lightning_dialog = LightningDialog(self)
|
self.lightning_dialog = LightningDialog(self)
|
||||||
self.lightning_dialog.bring_to_top()
|
self.lightning_dialog.bring_to_top()
|
||||||
|
|
|
@ -66,8 +66,11 @@ class ChannelsList(MyTreeView):
|
||||||
labels[subject] = label
|
labels[subject] = label
|
||||||
status = self.lnworker.get_channel_status(chan)
|
status = self.lnworker.get_channel_status(chan)
|
||||||
closed = chan.is_closed()
|
closed = chan.is_closed()
|
||||||
node_info = self.lnworker.channel_db.get_node_info_for_node_id(chan.node_id)
|
if self.parent.network.is_lightning_running():
|
||||||
node_alias = (node_info.alias if node_info else '') or ''
|
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 [
|
return [
|
||||||
format_short_channel_id(chan.short_channel_id),
|
format_short_channel_id(chan.short_channel_id),
|
||||||
bh2u(chan.node_id),
|
bh2u(chan.node_id),
|
||||||
|
|
|
@ -2076,6 +2076,8 @@ 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.is_lightning_running():
|
||||||
|
return
|
||||||
cur, total = self.network.lngossip.get_sync_progress_estimate()
|
cur, total = self.network.lngossip.get_sync_progress_estimate()
|
||||||
# self.logger.debug(f"updating lngossip sync progress estimate: cur={cur}, total={total}")
|
# self.logger.debug(f"updating lngossip sync progress estimate: cur={cur}, total={total}")
|
||||||
progress_percent = 0
|
progress_percent = 0
|
||||||
|
|
|
@ -322,6 +322,9 @@ class Network(Logger):
|
||||||
self.local_watchtower.start_network(self)
|
self.local_watchtower.start_network(self)
|
||||||
asyncio.ensure_future(self.local_watchtower.start_watching())
|
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):
|
def maybe_init_lightning(self):
|
||||||
if self.channel_db is None:
|
if self.channel_db is None:
|
||||||
from . import lnworker
|
from . import lnworker
|
||||||
|
|
Loading…
Add table
Reference in a new issue