Browse Source

follow-up invoice changes: fix qt lightning_tx_dialog

follow-up 719b468eee

Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\history_list.py", line 673, in mouseDoubleClickEvent
    self.parent.show_lightning_transaction(tx_item)
  File "...\electrum\electrum\gui\qt\main_window.py", line 1082, in show_lightning_transaction
    d = LightningTxDialog(self, tx_item)
  File "...\electrum\electrum\gui\qt\lightning_tx_dialog.py", line 60, in __init__
    self.invoice = invoice.lightning_invoice
AttributeError: 'Request' object has no attribute 'lightning_invoice'
master
SomberNight 3 years ago
parent
commit
26cc1b8308
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 18
      electrum/gui/qt/lightning_tx_dialog.py

18
electrum/gui/qt/lightning_tx_dialog.py

@ -32,6 +32,7 @@ from PyQt5.QtWidgets import QVBoxLayout, QLabel, QGridLayout
from electrum.i18n import _ from electrum.i18n import _
from electrum.lnworker import PaymentDirection from electrum.lnworker import PaymentDirection
from electrum.invoices import Invoice
from .util import WindowModalDialog, ShowQRLineEdit, ColorScheme, Buttons, CloseButton, font_height from .util import WindowModalDialog, ShowQRLineEdit, ColorScheme, Buttons, CloseButton, font_height
from .qrtextedit import ShowQRTextEdit from .qrtextedit import ShowQRTextEdit
@ -53,13 +54,11 @@ class LightningTxDialog(WindowModalDialog):
self.amount = Decimal(tx_item['amount_msat']) / 1000 self.amount = Decimal(tx_item['amount_msat']) / 1000
self.payment_hash = tx_item['payment_hash'] self.payment_hash = tx_item['payment_hash']
self.preimage = tx_item['preimage'] self.preimage = tx_item['preimage']
invoice = (self.parent.wallet.get_invoice(self.payment_hash) self.invoice = ""
or self.parent.wallet.get_request(self.payment_hash)) invoice = self.parent.wallet.get_invoice(self.payment_hash) # only check outgoing invoices
if invoice: if invoice:
assert invoice.is_lightning(), f"{self.invoice!r}" assert invoice.is_lightning(), f"{self.invoice!r}"
self.invoice = invoice.lightning_invoice self.invoice = invoice.lightning_invoice
else:
self.invoice = ''
self.setMinimumWidth(700) self.setMinimumWidth(700)
vbox = QVBoxLayout() vbox = QVBoxLayout()
self.setLayout(vbox) self.setLayout(vbox)
@ -78,9 +77,10 @@ class LightningTxDialog(WindowModalDialog):
vbox.addWidget(QLabel(_("Preimage") + ":")) vbox.addWidget(QLabel(_("Preimage") + ":"))
self.preimage_e = ShowQRLineEdit(self.preimage, self.config, title=_("Preimage")) self.preimage_e = ShowQRLineEdit(self.preimage, self.config, title=_("Preimage"))
vbox.addWidget(self.preimage_e) vbox.addWidget(self.preimage_e)
vbox.addWidget(QLabel(_("Lightning Invoice") + ":")) if self.invoice:
self.invoice_e = ShowQRTextEdit(self.invoice, config=self.config) vbox.addWidget(QLabel(_("Lightning Invoice") + ":"))
self.invoice_e.setMaximumHeight(max(150, 10 * font_height())) self.invoice_e = ShowQRTextEdit(self.invoice, config=self.config)
self.invoice_e.addCopyButton() self.invoice_e.setMaximumHeight(max(150, 10 * font_height()))
vbox.addWidget(self.invoice_e) self.invoice_e.addCopyButton()
vbox.addWidget(self.invoice_e)
vbox.addLayout(Buttons(CloseButton(self))) vbox.addLayout(Buttons(CloseButton(self)))

Loading…
Cancel
Save