-
Notifications
You must be signed in to change notification settings - Fork 370
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
public create_payment_onion in onion_utils #2677
public create_payment_onion in onion_utils #2677
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2677 +/- ##
==========================================
- Coverage 88.78% 88.77% -0.02%
==========================================
Files 112 113 +1
Lines 88474 89143 +669
Branches 88474 89143 +669
==========================================
+ Hits 78553 79136 +583
- Misses 7686 7751 +65
- Partials 2235 2256 +21
☔ View full report in Codecov by Sentry. |
0899529
to
fc04e36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a CI fix and rebase.
68a7d2f
to
5e4d49b
Compare
What's the usecase for peeling a payment onion? Generally that should only happen when actually forwarding a payment, no? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the usecase for peeling a payment onion? Generally that should only happen when actually forwarding a payment, no?
Not sure about OPs motivation, but want to note that the LSP client might eventually also need access to onion peeling when it comes to supporting LSPS4.
From what I heard, even other non-LDK based implementations would be interested in utilizing our onion tools to avoid having to reinvent the wheel.
lightning/src/ln/mod.rs
Outdated
@@ -39,6 +39,7 @@ pub(crate) mod onion_utils; | |||
mod outbound_payment; | |||
pub mod wire; | |||
|
|||
pub use onion_utils::{ForwardedPayment, PeeledPayment, ReceivedPayment, create_payment_onion, peel_payment_onion}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than exposing these directly under lightning::ln
, could we rather make onion_utils
pub
and expose these types under lightning::ln::onion_utils
?
Although we will be supporting self custody in Sphinx Chat app (via VLS), we also have a user group who cares less about self custody and more about instant onboarding and UX. Our app spins up many LN node id keys behind virtual (trustful) "private channels" from a real node. These clients can send payments privately with Of course its not the core use case that LDK is built for, but its pretty unprecedented for privacy (server can't track group membership, even for users on the same server!). And these users are interoperable with actual LN via route hints. FYI most chat messages in this design are actually bolt12 onions (not payments). But we will NOT be spamming LN p2p with bolt12 just for chat (non-payment onions are out of band) |
I don't think it makes sense to use "raw" onion peeling for this. In LSP4 we need to answer the question "would I accept this HTLC", which has a lot more checks than just looking at the onion. IMO that logic should live in LDK.
You mean 0conf channels or non-bitcoin-backed channels (ie 0conf where the funding just never confirms) or channels which are expected to carry no payments?
Why is the server unwraping the onion? Why is it not just forwarding a payment? I'm still quite confused. |
Oh, I guess you're saying like you want to forward payments but not have channels? ie the server receives an HTLC with a next-hop but that next-hop simply doesn't exist (and is intended to indicate updating a custodial balance)? We need way more than just exposing some stuff here, maybe let's chat about high-level design to get there first (and, also, why not just use a 0conf channel that never confirms?) |
Fair, we should def. discuss where the corresponding code should live when we get around to implementing it. So far I assumed it would live in the |
Exactly. The purpose is privacy, not custody. By peeling payments like this, the client can obfuscate activity various ways, like routing through other clients (the server doesn't know if an onion delivered to a client is actually destined for that client). Curious what else is needed besides the changes in this PR... its already all working on my end, using the CLN The other purpose is instant onboarding without a real channel open... my understanding of 0conf is a real channel open that is used before confirmation... what do you mean by 0conf that never confirms? |
d2859f4
to
0eddcbc
Compare
Is this (potentially) superseded by #2700? |
0d2b14e
to
5f1d66d
Compare
@valentinewallace FYI I removed the +1 in |
4ccda25
to
44bec16
Compare
50f048f
to
0c7b647
Compare
Ok, one last PR from me on this subject :)
Adds
create_payment_onion
andpeel_payment_onion
functions inln::onion_utils
. I added a newPeeledPayment
struct instead of using the existing (very similar)Hop
struct, to simplify the returned value and avoid leaking thefuzzy_internal_msgs
types.This PR is only additive, the only lines changed are just making things public