tkivy: handle lightning invoices on wallets that do not have lightning. fix #6371 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 9ddb6755504830402447599b9010a54e4b3fc287 DIR parent ac223073ba7998901bd9a10d32594ebf0583021f HTML Author: ThomasV <thomasv@electrum.org> Date: Wed, 9 Dec 2020 10:04:17 +0100 kivy: handle lightning invoices on wallets that do not have lightning. fix #6371 Diffstat: M electrum/gui/kivy/uix/dialogs/invo… | 2 +- M electrum/gui/kivy/uix/screens.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) --- DIR diff --git a/electrum/gui/kivy/uix/dialogs/invoice_dialog.py b/electrum/gui/kivy/uix/dialogs/invoice_dialog.py t@@ -98,7 +98,7 @@ class InvoiceDialog(Factory.Popup): self.description = invoice.message self.is_lightning = invoice.is_lightning() 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): invoice = self.app.wallet.get_invoice(self.key) DIR diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py t@@ -233,9 +233,10 @@ class SendScreen(CScreen, Logger): assert isinstance(item, LNInvoice) key = item.rhash address = key - log = self.app.wallet.lnworker.logs.get(key) - if status == PR_INFLIGHT and log: - status_str += '... (%d)'%len(log) + if self.app.wallet.lnworker: + log = self.app.wallet.lnworker.logs.get(key) + if status == PR_INFLIGHT and log: + status_str += '... (%d)'%len(log) is_bip70 = False else: assert isinstance(item, OnchainInvoice) t@@ -345,8 +346,10 @@ class SendScreen(CScreen, Logger): def do_pay_invoice(self, invoice): if invoice.is_lightning(): - self.app.protected(_('Pay lightning invoice?'), self._do_pay_lightning, (invoice,)) - return + if self.app.wallet.lnworker: + 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: do_pay = lambda rbf: self._do_pay_onchain(invoice, rbf) if self.app.electrum_config.get('use_rbf'):