diff --git a/electrum/lnonion.py b/electrum/lnonion.py index ead6eb9a5..0efff397f 100644 --- a/electrum/lnonion.py +++ b/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