Skip to content

Commit

Permalink
paytest: Do not assume the onion is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker authored and m-schmoock committed Mar 25, 2021
1 parent efd1b7e commit 6f2b8fb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paytest/paytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ def on_htlc_accepted(onion, htlc, request, plugin, *args, **kwargs):
# Decode the onion so we get the details the virtual recipient
# would get.
ro = RoutingOnion.from_hex(onion["next_onion"])
payload, next_onion = ro.unwrap(PRIVKEY, unhexlify(PAYMENT_HASH))
try:
payload, next_onion = ro.unwrap(PRIVKEY, unhexlify(PAYMENT_HASH))
except Exception:
return request.set_result({"result": "continue"})

if next_onion is not None:
# Whoops, apparently the virtual node isn't the last hop, fail
Expand Down

0 comments on commit 6f2b8fb

Please sign in to comment.