Skip to content

Report the sending peer in Event::OnionMessageIntercepted#4682

Open
jkczyz wants to merge 1 commit into
lightningdevkit:mainfrom
jkczyz:2026-06-onion-message-origin
Open

Report the sending peer in Event::OnionMessageIntercepted#4682
jkczyz wants to merge 1 commit into
lightningdevkit:mainfrom
jkczyz:2026-06-onion-message-origin

Conversation

@jkczyz

@jkczyz jkczyz commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

When the OnionMessenger intercepts a message bound for an offline peer, it now reports which peer sent us the message to forward via a new prev_node_id field, so handlers can apply source-based policy when deciding whether to forward. The existing destination field is renamed peer_node_id -> next_node_id so the two node ids are unambiguous.

prev_node_id is None when the forward is enqueued by a message handler (the BOLT 12 static-invoice-server flow), which isn't given the sending node; otherwise it is the node we received the message from.

@ldk-reviews-bot

ldk-reviews-bot commented Jun 11, 2026

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz jkczyz requested a review from TheBlueMatt June 11, 2026 14:28
@ldk-claude-review-bot

ldk-claude-review-bot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

The async_payments_tests.rs usages all use the .. pattern and the peer_node_id locals there are unrelated variables. Consistent with my prior review.

No issues found.

This is a re-review of the same commit (41ef2e6). My prior analysis holds: the field rename plus addition is clean — TLV field 0 remains the destination peer (backward/forward compatible), field 1 is the new optional prev_node_id, both call sites are updated consistently with the documented semantics, and all remaining match arms either were updated or use ... No new bugs, security problems, or logic errors detected.

@TheBlueMatt TheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. hate changing the api at this point but backporting to 0.3 probably should happen cause its trivial

Comment thread lightning/src/events/mod.rs Outdated
@ldk-reviews-bot

Copy link
Copy Markdown

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

When the OnionMessenger intercepts a message bound for an offline peer, it now
reports which peer sent us the message to forward via a new `prev_node_id`
field, so handlers can apply source-based policy when deciding whether to
forward. The existing destination field is renamed `peer_node_id` ->
`next_node_id` so the two node ids are unambiguous.

`prev_node_id` is `None` when the forward is enqueued by a message handler (the
BOLT 12 static-invoice-server flow), which isn't given the sending node;
otherwise it is the node we received the message from.

Co-Authored-By: Claude <noreply@anthropic.com>
@jkczyz jkczyz force-pushed the 2026-06-onion-message-origin branch from e0c7e55 to 41ef2e6 Compare June 11, 2026 15:01
@jkczyz jkczyz requested a review from TheBlueMatt June 11, 2026 15:01

@tnull tnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this seems to conflict with the first commit on #4463. Do you maybe want to pull that commit here to do it in one go?

@jkczyz jkczyz self-assigned this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants