mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 01:11:35 +00:00
parent
b6db201570
commit
89ddc1345d
2 changed files with 11 additions and 2 deletions
|
@ -405,6 +405,11 @@ class OnionRoutingFailureMessage:
|
|||
failure_data = failure_msg[2:]
|
||||
return OnionRoutingFailureMessage(failure_code, failure_data)
|
||||
|
||||
def code_name(self) -> str:
|
||||
if isinstance(self.code, OnionFailureCode):
|
||||
return str(self.code.name)
|
||||
return f"Unknown error ({self.code!r})"
|
||||
|
||||
|
||||
def construct_onion_error(reason: OnionRoutingFailureMessage,
|
||||
onion_packet: OnionPacket,
|
||||
|
|
|
@ -269,8 +269,12 @@ class PaymentAttemptLog(NamedTuple):
|
|||
sender_idx = self.failure_details.sender_idx
|
||||
failure_msg = self.failure_details.failure_msg
|
||||
if sender_idx is not None:
|
||||
short_channel_id = route[sender_idx+1].short_channel_id
|
||||
message = str(failure_msg.code.name)
|
||||
try:
|
||||
short_channel_id = route[sender_idx + 1].short_channel_id
|
||||
except IndexError:
|
||||
# payment destination reported error
|
||||
short_channel_id = _("Destination node")
|
||||
message = failure_msg.code_name()
|
||||
else:
|
||||
short_channel_id = route[-1].short_channel_id
|
||||
message = _('Success')
|
||||
|
|
Loading…
Add table
Reference in a new issue