qt channel details: maybe fix #5728

This commit is contained in:
SomberNight 2020-06-21 05:16:27 +02:00
parent 0f5b58851c
commit 1321b0e47a
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9
3 changed files with 13 additions and 5 deletions

View file

@ -46,7 +46,11 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
model = QtGui.QStandardItemModel(0, 2) model = QtGui.QStandardItemModel(0, 2)
model.setHorizontalHeaderLabels(['HTLC', 'Property value']) model.setHorizontalHeaderLabels(['HTLC', 'Property value'])
parentItem = model.invisibleRootItem() 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.folders = {}
self.keyname_rows = {} self.keyname_rows = {}
@ -80,7 +84,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
ln_payment_completed = QtCore.pyqtSignal(str, bytes, bytes) ln_payment_completed = QtCore.pyqtSignal(str, bytes, bytes)
ln_payment_failed = 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) state_changed = QtCore.pyqtSignal(str, Abstract_Wallet, AbstractChannel)
@QtCore.pyqtSlot(str, Abstract_Wallet, AbstractChannel) @QtCore.pyqtSlot(str, Abstract_Wallet, AbstractChannel)
@ -90,8 +94,10 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
if chan == self.chan: if chan == self.chan:
self.update() self.update()
@QtCore.pyqtSlot(str, UpdateAddHtlc, LnAddr, Direction) @QtCore.pyqtSlot(str, Channel, UpdateAddHtlc, Direction)
def do_htlc_added(self, evtname, htlc, lnaddr, direction): def do_htlc_added(self, evtname, chan, htlc, direction):
if chan != self.chan:
return
mapping = self.keyname_rows['inflight'] mapping = self.keyname_rows['inflight']
mapping[htlc.payment_hash] = len(mapping) mapping[htlc.payment_hash] = len(mapping)
self.folders['inflight'].appendRow(self.make_htlc_item(htlc, direction)) self.folders['inflight'].appendRow(self.make_htlc_item(htlc, direction))
@ -151,6 +157,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog):
vbox.addWidget(QLabel(_('Remote Node ID:'))) vbox.addWidget(QLabel(_('Remote Node ID:')))
remote_id_e = ButtonsLineEdit(bh2u(chan.node_id)) remote_id_e = ButtonsLineEdit(bh2u(chan.node_id))
remote_id_e.addCopyButton(self.window.app) remote_id_e.addCopyButton(self.window.app)
remote_id_e.setReadOnly(True)
vbox.addWidget(remote_id_e) vbox.addWidget(remote_id_e)
funding_label_text = f'<a href=click_destination>{chan.funding_outpoint.txid}</a>:{chan.funding_outpoint.output_index}' funding_label_text = f'<a href=click_destination>{chan.funding_outpoint.txid}</a>:{chan.funding_outpoint.output_index}'
vbox.addWidget(QLabel(_('Funding Outpoint:'))) vbox.addWidget(QLabel(_('Funding Outpoint:')))

View file

@ -1181,6 +1181,7 @@ class Peer(Logger):
timestamp=int(time.time()), timestamp=int(time.time()),
htlc_id=htlc_id) htlc_id=htlc_id)
chan.receive_htlc(htlc, onion_packet) chan.receive_htlc(htlc, onion_packet)
util.trigger_callback('htlc_added', chan, htlc, RECEIVED)
def maybe_forward_htlc(self, chan: Channel, htlc: UpdateAddHtlc, *, def maybe_forward_htlc(self, chan: Channel, htlc: UpdateAddHtlc, *,
onion_packet: OnionPacket, processed_onion: ProcessedOnionPacket onion_packet: OnionPacket, processed_onion: ProcessedOnionPacket

View file

@ -888,7 +888,7 @@ class LNWallet(LNWorker):
payment_hash=lnaddr.paymenthash, payment_hash=lnaddr.paymenthash,
min_final_cltv_expiry=lnaddr.get_min_final_cltv_expiry(), min_final_cltv_expiry=lnaddr.get_min_final_cltv_expiry(),
payment_secret=lnaddr.payment_secret) 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) payment_attempt = await self.await_payment(lnaddr.paymenthash)
if payment_attempt.success: if payment_attempt.success:
failure_log = None failure_log = None