electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 1321b0e47abbebedf32f5335e563311085fd173e
parent 0f5b58851c997de525f6fbfbd114ee3d1aa9255e
Author: SomberNight <somber.night@protonmail.com>
Date:   Sun, 21 Jun 2020 05:16:27 +0200

qt channel details: maybe fix #5728

Diffstat:
Melectrum/gui/qt/channel_details.py | 15+++++++++++----
Melectrum/lnpeer.py | 1+
Melectrum/lnworker.py | 2+-
3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/electrum/gui/qt/channel_details.py b/electrum/gui/qt/channel_details.py @@ -46,7 +46,11 @@ class ChannelDetailsDialog(QtWidgets.QDialog): model = QtGui.QStandardItemModel(0, 2) model.setHorizontalHeaderLabels(['HTLC', 'Property value']) parentItem = model.invisibleRootItem() - folder_types = {'settled': _('Fulfilled HTLCs'), 'inflight': _('HTLCs in current commitment transaction'), 'failed': _('Failed HTLCs')} + folder_types = { + 'settled': _('Fulfilled HTLCs'), + 'inflight': _('HTLCs in current commitment transaction'), + 'failed': _('Failed HTLCs'), + } self.folders = {} self.keyname_rows = {} @@ -80,7 +84,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog): ln_payment_completed = QtCore.pyqtSignal(str, bytes, bytes) ln_payment_failed = QtCore.pyqtSignal(str, bytes, bytes) - htlc_added = QtCore.pyqtSignal(str, UpdateAddHtlc, LnAddr, Direction) + htlc_added = QtCore.pyqtSignal(str, Channel, UpdateAddHtlc, Direction) state_changed = QtCore.pyqtSignal(str, Abstract_Wallet, AbstractChannel) @QtCore.pyqtSlot(str, Abstract_Wallet, AbstractChannel) @@ -90,8 +94,10 @@ class ChannelDetailsDialog(QtWidgets.QDialog): if chan == self.chan: self.update() - @QtCore.pyqtSlot(str, UpdateAddHtlc, LnAddr, Direction) - def do_htlc_added(self, evtname, htlc, lnaddr, direction): + @QtCore.pyqtSlot(str, Channel, UpdateAddHtlc, Direction) + def do_htlc_added(self, evtname, chan, htlc, direction): + if chan != self.chan: + return mapping = self.keyname_rows['inflight'] mapping[htlc.payment_hash] = len(mapping) self.folders['inflight'].appendRow(self.make_htlc_item(htlc, direction)) @@ -151,6 +157,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog): vbox.addWidget(QLabel(_('Remote Node ID:'))) remote_id_e = ButtonsLineEdit(bh2u(chan.node_id)) remote_id_e.addCopyButton(self.window.app) + remote_id_e.setReadOnly(True) vbox.addWidget(remote_id_e) funding_label_text = f'<a href=click_destination>{chan.funding_outpoint.txid}</a>:{chan.funding_outpoint.output_index}' vbox.addWidget(QLabel(_('Funding Outpoint:'))) diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py @@ -1181,6 +1181,7 @@ class Peer(Logger): timestamp=int(time.time()), htlc_id=htlc_id) chan.receive_htlc(htlc, onion_packet) + util.trigger_callback('htlc_added', chan, htlc, RECEIVED) def maybe_forward_htlc(self, chan: Channel, htlc: UpdateAddHtlc, *, onion_packet: OnionPacket, processed_onion: ProcessedOnionPacket diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -888,7 +888,7 @@ class LNWallet(LNWorker): payment_hash=lnaddr.paymenthash, min_final_cltv_expiry=lnaddr.get_min_final_cltv_expiry(), payment_secret=lnaddr.payment_secret) - util.trigger_callback('htlc_added', htlc, lnaddr, SENT) + util.trigger_callback('htlc_added', chan, htlc, SENT) payment_attempt = await self.await_payment(lnaddr.paymenthash) if payment_attempt.success: failure_log = None