Browse Source

follow-up 1c8a4bcfa497b117e4511c2f108dbca8a1adb793

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
ThomasV 6 years ago
parent
commit
1ebd1baebf
  1. 33
      electrum/lnbase.py

33
electrum/lnbase.py

@ -1042,28 +1042,17 @@ class Peer(PrintError):
data = failure_msg.data data = failure_msg.data
self.print_error("UPDATE_FAIL_HTLC", repr(code), data) self.print_error("UPDATE_FAIL_HTLC", repr(code), data)
# handle some specific error codes # handle some specific error codes
if code == OnionFailureCode.TEMPORARY_CHANNEL_FAILURE: failure_codes = {
channel_update = (258).to_bytes(length=2, byteorder="big") + data[2:] OnionFailureCode.TEMPORARY_CHANNEL_FAILURE: 2
message_type, payload = decode_msg(channel_update) OnionFailureCode.AMOUNT_BELOW_MINIMUM: 10
self.on_channel_update(payload) OnionFailureCode.FEE_INSUFFICIENT: 10
elif code == OnionFailureCode.AMOUNT_BELOW_MINIMUM: OnionFailureCode.INCORRECT_CLTV_EXPIRY: 6
channel_update = (258).to_bytes(length=2, byteorder="big") + data[10:] OnionFailureCode.EXPIRY_TOO_SOON: 2
message_type, payload = decode_msg(channel_update) OnionFailureCode.CHANNEL_DISABLED: 4
self.on_channel_update(payload) }
elif code == OnionFailureCode.FEE_INSUFFICIENT: offset = failure_codes.get(code)
channel_update = (258).to_bytes(length=2, byteorder="big") + data[10:] if offset:
message_type, payload = decode_msg(channel_update) channel_update = (258).to_bytes(length=2, byteorder="big") + data[offset:]
self.on_channel_update(payload)
elif code == OnionFailureCode.INCORRECT_CLTV_EXPIRY:
channel_update = (258).to_bytes(length=2, byteorder="big") + data[6:]
message_type, payload = decode_msg(channel_update)
self.on_channel_update(payload)
elif code == OnionFailureCode.EXPIRY_TOO_SOON:
channel_update = (258).to_bytes(length=2, byteorder="big") + data[2:]
message_type, payload = decode_msg(channel_update)
self.on_channel_update(payload)
elif code == OnionFailureCode.CHANNEL_DISABLED:
channel_update = (258).to_bytes(length=2, byteorder="big") + data[4:]
message_type, payload = decode_msg(channel_update) message_type, payload = decode_msg(channel_update)
self.on_channel_update(payload) self.on_channel_update(payload)
else: else:

Loading…
Cancel
Save