|
@ -1574,7 +1574,7 @@ class Peer(Logger): |
|
|
def fulfill_htlc(self, chan: Channel, htlc_id: int, preimage: bytes): |
|
|
def fulfill_htlc(self, chan: Channel, htlc_id: int, preimage: bytes): |
|
|
self.logger.info(f"_fulfill_htlc. chan {chan.short_channel_id}. htlc_id {htlc_id}") |
|
|
self.logger.info(f"_fulfill_htlc. chan {chan.short_channel_id}. htlc_id {htlc_id}") |
|
|
assert chan.can_send_ctx_updates(), f"cannot send updates: {chan.short_channel_id}" |
|
|
assert chan.can_send_ctx_updates(), f"cannot send updates: {chan.short_channel_id}" |
|
|
assert chan.hm.is_add_htlc_irrevocably_committed_yet(htlc_proposer=REMOTE, htlc_id=htlc_id) |
|
|
assert chan.hm.is_htlc_irrevocably_added_yet(htlc_proposer=REMOTE, htlc_id=htlc_id) |
|
|
chan.settle_htlc(preimage, htlc_id) |
|
|
chan.settle_htlc(preimage, htlc_id) |
|
|
self.send_message( |
|
|
self.send_message( |
|
|
"update_fulfill_htlc", |
|
|
"update_fulfill_htlc", |
|
@ -1809,7 +1809,7 @@ class Peer(Logger): |
|
|
done = set() |
|
|
done = set() |
|
|
unfulfilled = chan.hm.log.get('unfulfilled_htlcs', {}) |
|
|
unfulfilled = chan.hm.log.get('unfulfilled_htlcs', {}) |
|
|
for htlc_id, (local_ctn, remote_ctn, onion_packet_hex, forwarding_info) in unfulfilled.items(): |
|
|
for htlc_id, (local_ctn, remote_ctn, onion_packet_hex, forwarding_info) in unfulfilled.items(): |
|
|
if not chan.hm.is_add_htlc_irrevocably_committed_yet(htlc_proposer=REMOTE, htlc_id=htlc_id): |
|
|
if not chan.hm.is_htlc_irrevocably_added_yet(htlc_proposer=REMOTE, htlc_id=htlc_id): |
|
|
continue |
|
|
continue |
|
|
htlc = chan.hm.get_htlc_by_id(REMOTE, htlc_id) |
|
|
htlc = chan.hm.get_htlc_by_id(REMOTE, htlc_id) |
|
|
error_reason = None # type: Optional[OnionRoutingFailure] |
|
|
error_reason = None # type: Optional[OnionRoutingFailure] |
|
|