Skip to content

Commit

Permalink
lnworker: change api of 'htlc_{fulfilled,failed}' events
Browse files Browse the repository at this point in the history
  • Loading branch information
SomberNight committed Nov 4, 2021
1 parent 16c6655 commit 4f907e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions electrum/gui/qt/channel_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def move(self, fro: str, to: str, payment_hash: bytes):
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)

Expand All @@ -103,16 +103,16 @@ def on_htlc_added(self, evtname, chan, htlc, direction):
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()
Expand Down
6 changes: 3 additions & 3 deletions electrum/lnworker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1847,8 +1847,8 @@ def set_payment_status(self, payment_hash: bytes, status: int) -> None:
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)]
Expand All @@ -1870,7 +1870,7 @@ def htlc_failed(
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
Expand Down

0 comments on commit 4f907e3

Please sign in to comment.