Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sender is the introduction node onion messages #2951

Merged

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Mar 19, 2024

DefaultMessageRouter will form an OnionMessagePath from a BlindedPath where the sender is the introduction node but only if the sender is announced. If the sender is unannounced, then DefaultMessageRouter will fail. While DefaultMessageRouter will only create a blinded path with an announced introduction node, it may receive one where the introduction node is unannounced. Don't return an error in this case, as the OnionMessenger can advance the blinded path by one hop.

This may occur when two nodes have an unannounced channel and one (the offer creator) wants to use it for payments without an intermediary node and without putting its node id in the offer.

DefaultMessageRouter will form an OnionMessagePath from a BlindedPath
where the sender is the introduction node but only if the sender is
announced. If the sender is unannounced, then DefaultMessageRouter will
fail. While DefaultMessageRouter will only create a blinded path with an
announced introduction node, it may receive one where the introduction
node is unannounced. Don't return an error in this case, as the
OnionMessenger can advance the blinded path by one hop.

This may occur when two nodes have an unannounced channel and one (the
offer creator) wants to use it for payments without an intermediary node
and without putting its node id in the offer.
Give pub(crate) visibility to some routing test utilities to facilitate
testing DefaultMessageRouter in functional tests.
This helps test cases in DefaultMessageRouter that may not be exercised
now or in the future.
Use OnionMessenger's public interface in tests whenever possible (i.e.,
when not using any intermediate_nodes in an OnionMessagePath. This
allows us to exercise DefaultMessageRouter, and, in particular that a
path can be found for an unannounced sender when its in the introduction
node.
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.62%. Comparing base (670b41a) to head (806fef5).
Report is 33 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2951      +/-   ##
==========================================
+ Coverage   89.11%   89.62%   +0.51%     
==========================================
  Files         117      117              
  Lines       95029    97762    +2733     
  Branches    95029    97762    +2733     
==========================================
+ Hits        84685    87621    +2936     
+ Misses       7856     7692     -164     
+ Partials     2488     2449      -39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dunxen dunxen left a comment

Choose a reason for hiding this comment

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

LGTM

CI failures unrelated and on main. Do we have an issue tracking them?

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

LGTM, although in this context I'd like to (briefly) raise the question again whether we should relax some of the announcement checks for the introduction node to also support BOLT12 between two directly-connected nodes, i.e., something along the lines of tnull@8138bec

If we're really concerned about the privacy leakage, it would be nice to at least expose a config flag allowing to do this, as otherwise it's pretty confusing for users why they could send payments via an intermediate node, but not directly.

@TheBlueMatt
Copy link
Collaborator

Can you open an issue? That seems at least marginally unrelated and I'd like to better understand the failure cases and don't want to derail this PR.

@TheBlueMatt TheBlueMatt merged commit 0cc0858 into lightningdevkit:main Mar 20, 2024
13 of 16 checks passed
@tnull
Copy link
Contributor

tnull commented Mar 20, 2024

Can you open an issue? That seems at least marginally unrelated and I'd like to better understand the failure cases and don't want to derail this PR.

Yes, sorry, this was definitely not my intention. Now tracking here: #2952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants