Browse Source

kivy: handle lightning invoices on wallets that do not have lightning. fix #6371

patch-4
ThomasV 4 years ago
parent
commit
9ddb675550
  1. 2
      electrum/gui/kivy/uix/dialogs/invoice_dialog.py
  2. 13
      electrum/gui/kivy/uix/screens.py

2
electrum/gui/kivy/uix/dialogs/invoice_dialog.py

@ -98,7 +98,7 @@ class InvoiceDialog(Factory.Popup):
self.description = invoice.message self.description = invoice.message
self.is_lightning = invoice.is_lightning() self.is_lightning = invoice.is_lightning()
self.update_status() self.update_status()
self.log = self.app.wallet.lnworker.logs[self.key] if self.is_lightning else [] self.log = self.app.wallet.lnworker.logs[self.key] if self.is_lightning and self.app.wallet.lnworker else []
def update_status(self): def update_status(self):
invoice = self.app.wallet.get_invoice(self.key) invoice = self.app.wallet.get_invoice(self.key)

13
electrum/gui/kivy/uix/screens.py

@ -233,9 +233,10 @@ class SendScreen(CScreen, Logger):
assert isinstance(item, LNInvoice) assert isinstance(item, LNInvoice)
key = item.rhash key = item.rhash
address = key address = key
log = self.app.wallet.lnworker.logs.get(key) if self.app.wallet.lnworker:
if status == PR_INFLIGHT and log: log = self.app.wallet.lnworker.logs.get(key)
status_str += '... (%d)'%len(log) if status == PR_INFLIGHT and log:
status_str += '... (%d)'%len(log)
is_bip70 = False is_bip70 = False
else: else:
assert isinstance(item, OnchainInvoice) assert isinstance(item, OnchainInvoice)
@ -345,8 +346,10 @@ class SendScreen(CScreen, Logger):
def do_pay_invoice(self, invoice): def do_pay_invoice(self, invoice):
if invoice.is_lightning(): if invoice.is_lightning():
self.app.protected(_('Pay lightning invoice?'), self._do_pay_lightning, (invoice,)) if self.app.wallet.lnworker:
return self.app.protected(_('Pay lightning invoice?'), self._do_pay_lightning, (invoice,))
else:
self.app.show_error(_("Lightning payments are not available for this wallet"))
else: else:
do_pay = lambda rbf: self._do_pay_onchain(invoice, rbf) do_pay = lambda rbf: self._do_pay_onchain(invoice, rbf)
if self.app.electrum_config.get('use_rbf'): if self.app.electrum_config.get('use_rbf'):

Loading…
Cancel
Save