commit cf5872d2c1ab3eb95a460d19915fde449f771877
parent 2cc76fbbbda3b49262dda7f00a9d7ea6a1c39761
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 17 Mar 2020 21:19:26 +0100
follow-up prev
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py
@@ -1226,7 +1226,7 @@ class Peer(Logger):
self.logger.info(f"fail_htlc. chan {chan.short_channel_id}. htlc_id {htlc_id}. reason: {reason}")
assert chan.can_send_ctx_updates(), f"cannot send updates: {chan.short_channel_id}"
chan.fail_htlc(htlc_id)
- if onion_packet:
+ if onion_packet and reason:
error_bytes = construct_onion_error(reason, onion_packet, our_onion_private_key=self.privkey)
if error_bytes:
self.send_message("update_fail_htlc",
@@ -1235,6 +1235,7 @@ class Peer(Logger):
len=len(error_bytes),
reason=error_bytes)
else:
+ assert reason is not None
if not (reason.code & OnionFailureCodeMetaFlag.BADONION and len(reason.data) == 32):
raise Exception(f"unexpected reason when sending 'update_fail_malformed_htlc': {reason!r}")
self.send_message("update_fail_malformed_htlc",