From b26f954c2d06b7bc5a30d07e20aa23c1290b3a54 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 20 Oct 2023 13:12:58 +0200 Subject: [PATCH] lnworker.pay_to_node: skip error handling if sender_idx is None --- electrum/lnworker.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 798c970c1..3b5e09511 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -1527,6 +1527,8 @@ class LNWallet(LNWorker): # if we get a channel update, we might retry the same route and amount route = htlc_log.route sender_idx = htlc_log.sender_idx + if sender_idx is None: + raise PaymentFailure(failure_msg.code_name()) erring_node_id = route[sender_idx].node_id failure_msg = htlc_log.failure_msg code, data = failure_msg.code, failure_msg.data @@ -1616,9 +1618,6 @@ class LNWallet(LNWorker): OnionFailureCode.EXPIRY_TOO_SOON: 0, OnionFailureCode.CHANNEL_DISABLED: 2, } - - if sender_idx is None: - raise PaymentFailure(failure_msg.code_name()) try: failing_channel = route[sender_idx + 1].short_channel_id except IndexError: @@ -2353,7 +2352,7 @@ class LNWallet(LNWorker): onion_key) except Exception as e: sender_idx = None - failure_message = OnionRoutingFailure(-1, str(e)) + failure_message = OnionRoutingFailure(OnionFailureCode.INVALID_ONION_PAYLOAD, str(e).encode()) else: # probably got "update_fail_malformed_htlc". well... who to penalise now? assert failure_message is not None