Browse Source

fix running with --offline

patch-4
SomberNight 4 years ago
parent
commit
12fac3a167
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 11
      electrum/gui/kivy/main_window.py
  2. 8
      electrum/gui/kivy/uix/dialogs/lightning_channels.py
  3. 2
      electrum/lnworker.py

11
electrum/gui/kivy/main_window.py

@ -188,11 +188,12 @@ class ElectrumWindow(App, Logger):
use_gossip = BooleanProperty(False)
def on_use_gossip(self, instance, x):
self.electrum_config.set_key('use_gossip', self.use_gossip, True)
if self.use_gossip:
self.network.start_gossip()
else:
self.network.run_from_another_thread(
self.network.stop_gossip())
if self.network:
if self.use_gossip:
self.network.start_gossip()
else:
self.network.run_from_another_thread(
self.network.stop_gossip())
use_change = BooleanProperty(False)
def on_use_change(self, instance, x):

8
electrum/gui/kivy/uix/dialogs/lightning_channels.py

@ -172,6 +172,7 @@ Builder.load_string(r'''
<LightningChannelsDialog@Popup>:
name: 'lightning_channels'
title: _('Lightning Network')
has_network: False
has_lightning: False
has_gossip: False
can_send: ''
@ -205,13 +206,13 @@ Builder.load_string(r'''
size_hint: 0.3, None
height: '48dp'
text: _('Open Channel')
disabled: not root.has_lightning
disabled: not (root.has_network and root.has_lightning)
on_release: popup.app.popup_dialog('lightning_open_channel_dialog')
Button:
size_hint: 0.3, None
height: '48dp'
text: _('Swap')
disabled: not root.has_lightning
disabled: not (root.has_network and root.has_lightning)
on_release: popup.app.popup_dialog('swap_dialog')
Button:
size_hint: 0.3, None
@ -589,8 +590,9 @@ class LightningChannelsDialog(Factory.Popup):
super(LightningChannelsDialog, self).__init__()
self.clocks = []
self.app = app
self.has_network = bool(self.app.network)
self.has_lightning = app.wallet.has_lightning()
self.has_gossip = self.app.network.channel_db is not None
self.has_gossip = self.has_network and self.app.network.channel_db is not None
self.update()
def show_item(self, obj):

2
electrum/lnworker.py

@ -845,6 +845,8 @@ class LNWallet(LNWorker):
item = chan.get_funding_height()
if item is None:
continue
if not self.lnwatcher:
continue # lnwatcher not available with --offline (its data is not persisted)
funding_txid, funding_height, funding_timestamp = item
tx_height = self.lnwatcher.get_tx_height(funding_txid)
item = {

Loading…
Cancel
Save