lnworker.pay_to_node: skip error handling if sender_idx is None
This commit is contained in:
@@ -1527,6 +1527,8 @@ class LNWallet(LNWorker):
|
|||||||
# if we get a channel update, we might retry the same route and amount
|
# if we get a channel update, we might retry the same route and amount
|
||||||
route = htlc_log.route
|
route = htlc_log.route
|
||||||
sender_idx = htlc_log.sender_idx
|
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
|
erring_node_id = route[sender_idx].node_id
|
||||||
failure_msg = htlc_log.failure_msg
|
failure_msg = htlc_log.failure_msg
|
||||||
code, data = failure_msg.code, failure_msg.data
|
code, data = failure_msg.code, failure_msg.data
|
||||||
@@ -1616,9 +1618,6 @@ class LNWallet(LNWorker):
|
|||||||
OnionFailureCode.EXPIRY_TOO_SOON: 0,
|
OnionFailureCode.EXPIRY_TOO_SOON: 0,
|
||||||
OnionFailureCode.CHANNEL_DISABLED: 2,
|
OnionFailureCode.CHANNEL_DISABLED: 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
if sender_idx is None:
|
|
||||||
raise PaymentFailure(failure_msg.code_name())
|
|
||||||
try:
|
try:
|
||||||
failing_channel = route[sender_idx + 1].short_channel_id
|
failing_channel = route[sender_idx + 1].short_channel_id
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@@ -2353,7 +2352,7 @@ class LNWallet(LNWorker):
|
|||||||
onion_key)
|
onion_key)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sender_idx = None
|
sender_idx = None
|
||||||
failure_message = OnionRoutingFailure(-1, str(e))
|
failure_message = OnionRoutingFailure(OnionFailureCode.INVALID_ONION_PAYLOAD, str(e).encode())
|
||||||
else:
|
else:
|
||||||
# probably got "update_fail_malformed_htlc". well... who to penalise now?
|
# probably got "update_fail_malformed_htlc". well... who to penalise now?
|
||||||
assert failure_message is not None
|
assert failure_message is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user