Skip to content

Commit

Permalink
onion_messages: fix next_hop in hopdata building from route in the pu…
Browse files Browse the repository at this point in the history
…bkey case

also clear up some comment phrasing
  • Loading branch information
accumulator committed Nov 4, 2024
1 parent 3c8cde1 commit 9717523
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions electrum/onion_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ def send_onion_message_to(lnwallet: 'LNWallet', node_id_or_blinded_path: bytes,
if path is None:
raise Exception('no path found')

# first hop must be our peer
# first edge must be to our peer
peer = lnwallet.peers.get(path[0].end_node)
assert peer, 'first hop not a peer'

# last hop is introduction point and start of blinded path. remove from route
# last edge is to introduction point and start of blinded path. remove from route
assert path[-1].end_node == introduction_point, 'last hop in route must be introduction point'

path = path[:-1]
Expand Down Expand Up @@ -279,15 +279,15 @@ def send_onion_message_to(lnwallet: 'LNWallet', node_id_or_blinded_path: bytes,
if path is None:
raise Exception('no path found')

# first hop must be our peer
# first edge must be to our peer
peer = lnwallet.peers.get(path[0].end_node)
assert peer, 'first hop not a peer'

hops_data = [
OnionHopsDataSingle(
tlv_stream_name='onionmsg_tlv',
blind_fields={'next_node_id': {'node_id': x.end_node}}
) for x in path[:-1]
) for x in path[1:]
]

final_hop = OnionHopsDataSingle(
Expand Down

0 comments on commit 9717523

Please sign in to comment.