Browse Source

lnworker: change api of 'htlc_{fulfilled,failed}' events

patch-4
SomberNight 3 years ago
parent
commit
4f907e3889
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 16
      electrum/gui/qt/channel_details.py
  2. 6
      electrum/lnworker.py

16
electrum/gui/qt/channel_details.py

@ -83,8 +83,8 @@ class ChannelDetailsDialog(QtWidgets.QDialog, MessageBoxMixin):
dest_mapping = self.keyname_rows[to]
dest_mapping[payment_hash] = len(dest_mapping)
htlc_fulfilled = QtCore.pyqtSignal(str, bytes, bytes)
htlc_failed = QtCore.pyqtSignal(str, bytes, bytes)
htlc_fulfilled = QtCore.pyqtSignal(str, bytes, Channel, int)
htlc_failed = QtCore.pyqtSignal(str, bytes, Channel, int)
htlc_added = QtCore.pyqtSignal(str, Channel, UpdateAddHtlc, Direction)
state_changed = QtCore.pyqtSignal(str, Abstract_Wallet, AbstractChannel)
@ -103,16 +103,16 @@ class ChannelDetailsDialog(QtWidgets.QDialog, MessageBoxMixin):
mapping[htlc.payment_hash] = len(mapping)
self.folders['inflight'].appendRow(self.make_htlc_item(htlc, direction))
@QtCore.pyqtSlot(str, bytes, bytes)
def on_htlc_fulfilled(self, evtname, payment_hash, chan_id):
if chan_id != self.chan.channel_id:
@QtCore.pyqtSlot(str, bytes, Channel, int)
def on_htlc_fulfilled(self, evtname, payment_hash, chan, htlc_id):
if chan.channel_id != self.chan.channel_id:
return
self.move('inflight', 'settled', payment_hash)
self.update()
@QtCore.pyqtSlot(str, bytes, bytes)
def on_htlc_failed(self, evtname, payment_hash, chan_id):
if chan_id != self.chan.channel_id:
@QtCore.pyqtSlot(str, bytes, Channel, int)
def on_htlc_failed(self, evtname, payment_hash, chan, htlc_id):
if chan.channel_id != self.chan.channel_id:
return
self.move('inflight', 'failed', payment_hash)
self.update()

6
electrum/lnworker.py

@ -1847,8 +1847,8 @@ class LNWallet(LNWorker):
info = info._replace(status=status)
self.save_payment_info(info)
def htlc_fulfilled(self, chan, payment_hash: bytes, htlc_id:int):
util.trigger_callback('htlc_fulfilled', payment_hash, chan.channel_id)
def htlc_fulfilled(self, chan: Channel, payment_hash: bytes, htlc_id: int):
util.trigger_callback('htlc_fulfilled', payment_hash, chan, htlc_id)
q = self.sent_htlcs.get(payment_hash)
if q:
route, payment_secret, amount_msat, bucket_msat, amount_receiver_msat = self.sent_htlcs_routes[(payment_hash, chan.short_channel_id, htlc_id)]
@ -1870,7 +1870,7 @@ class LNWallet(LNWorker):
error_bytes: Optional[bytes],
failure_message: Optional['OnionRoutingFailure']):
util.trigger_callback('htlc_failed', payment_hash, chan.channel_id)
util.trigger_callback('htlc_failed', payment_hash, chan, htlc_id)
q = self.sent_htlcs.get(payment_hash)
if q:
# detect if it is part of a bucket

Loading…
Cancel
Save