Browse Source

Qt show_lightning_invoice: show features

patch-4
ThomasV 3 years ago
parent
commit
85d354bf24
  1. 20
      electrum/gui/qt/main_window.py
  2. 6
      electrum/lnutil.py

20
electrum/gui/qt/main_window.py

@ -1456,20 +1456,24 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
grid.addWidget(QLabel(amount_str), 1, 1)
grid.addWidget(QLabel(_("Description") + ':'), 2, 0)
grid.addWidget(QLabel(invoice.message), 2, 1)
grid.addWidget(QLabel(_("Hash") + ':'), 3, 0)
grid.addWidget(QLabel(_("Creation time") + ':'), 3, 0)
grid.addWidget(QLabel(format_time(invoice.time)), 3, 1)
if invoice.exp:
grid.addWidget(QLabel(_("Expiration time") + ':'), 4, 0)
grid.addWidget(QLabel(format_time(invoice.time + invoice.exp)), 4, 1)
grid.addWidget(QLabel(_('Features') + ':'), 5, 0)
grid.addWidget(QLabel('\n'.join(lnaddr.get_features().get_names())), 5, 1)
payhash_e = ButtonsLineEdit(lnaddr.paymenthash.hex())
payhash_e.addCopyButton()
payhash_e.setReadOnly(True)
vbox.addWidget(payhash_e)
grid.addWidget(payhash_e, 3, 1)
if invoice.exp:
grid.addWidget(QLabel(_("Expires") + ':'), 4, 0)
grid.addWidget(QLabel(format_time(invoice.time + invoice.exp)), 4, 1)
vbox.addLayout(grid)
grid.addWidget(QLabel(_("Payment Hash") + ':'), 6, 0)
grid.addWidget(payhash_e, 6, 1)
invoice_e = ShowQRTextEdit(config=self.config)
invoice_e.addCopyButton()
invoice_e.setText(invoice.lightning_invoice)
vbox.addWidget(invoice_e)
grid.addWidget(QLabel(_('Text') + ':'), 7, 0)
grid.addWidget(invoice_e, 7, 1)
vbox.addLayout(grid)
vbox.addLayout(Buttons(CloseButton(d),))
d.exec_()

6
electrum/lnutil.py

@ -1192,6 +1192,12 @@ class LnFeatures(IntFlag):
return (flag in our_flags
or get_ln_flag_pair_of_bit(flag) in our_flags)
def get_names(self):
r = []
for flag in list_enabled_bits(self):
r.append(LnFeatures(1 << flag).name)
return r
class ChannelType(IntFlag):
OPTION_LEGACY_CHANNEL = 0

Loading…
Cancel
Save