Browse Source

lnonion: get_failure_msg_from_onion_error might raise in python 3.7

this used to work in py3.6 but raises in py3.7 :(
(see https://bugs.python.org/issue34536)
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight 5 years ago
parent
commit
2a604b1676
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 11
      electrum/lnonion.py

11
electrum/lnonion.py

@ -348,7 +348,10 @@ def get_failure_msg_from_onion_error(decrypted_error_packet: bytes) -> OnionRout
failure_msg = decrypted_error_packet[34:34+failure_len]
# create failure message object
failure_code = int.from_bytes(failure_msg[:2], byteorder='big')
failure_code = OnionFailureCode(failure_code)
try:
failure_code = OnionFailureCode(failure_code)
except ValueError:
pass # uknown failure code
failure_data = failure_msg[2:]
return OnionRoutingFailureMessage(failure_code, failure_data)
@ -387,12 +390,6 @@ class OnionFailureCode(IntEnum):
CHANNEL_DISABLED = UPDATE | 20
EXPIRY_TOO_FAR = 21
@classmethod
def _missing_(cls, value: int) -> int:
# note that for unknown error codes, we return an int,
# not an instance of cls
return value
# don't use these elsewhere, the names are ambiguous without context
del BADONION; del PERM; del NODE; del UPDATE

Loading…
Cancel
Save