-
Notifications
You must be signed in to change notification settings - Fork 375
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
Payjoin integration with LDK #2944
Comments
Indeed, IMO it would be nice to have as much common logic in a separate crate as possible.
Not sure I understand this - once we have built the funding tx cooperatively with our payjoin partner, we should be good to go to broadcast, no? Not sure I understand why LDK can't be in control of when the tx gets broadcasted. |
In the payjoin protocol, the "payjoin sender" is the party responsible for broadcasting the transaction and in our use case we will be the "payjoin receiver". See the diagram here lightningdevkit/ldk-node#257 (comment). If we run a lightning node A and we want to open a channel with node B, we can schedule a channel that will be created once we receive a payjoin request into our node(A). So node A is the "payjoin receiver". The reason we cannot broadcast the transaction is we still need the "payjoin sender" to sign the PSBT after we are done with the channel negotiation(ie got PSBT after I thought about adding a flag to |
Why not just run the payjoin protocol after |
Yes, this was also my first question. To quote myself from a previous conversation, where I had proposed the following flow:
However, IIUC, the PJ sender provides a PSBT the funder needs to know/use, so it has to run before |
I think coupling both processes (or doing payjoin in the middle) can be tricky in the following scenarios:
I think in general we would want some So the node wallet gets notified about an incoming payjoin tx, we loops through the scheduled channels and try to batch them in the same tx What kind of limitations do we have once we got Why do you prefer the payjoin process to happen after |
To meet the payjoin protcol spec, after we are done changing the PSBT outputs and maybe add inputs, we are expected to send whats called |
I don't see why that changes things? You can just wait until all channels are ready for funding and do the payjoin then. Worse, I'm really scared of letting users manually handle broadcast of batch channels, there's a lot that can go wrong.
Not quite sure I understand this one - lightning nodes expect to know the channel size after One general note, in LDK you can intercept the broadcast and handle it yourself, if you really want - the broadcast goes out via the |
I think we could probably run the payjoin protocol in different stages(It will make it tricky but manageable with channel amount) but we cant respond back to the payjoin sender before we receive FundingSigned as that could put the funds in risk because the payjoin sender have the tx and they could broadcast it but we never receive the |
Right, that seems like it wouldn't require any LDK changes, I think, and generally be the same implementation complexity on the payjoin side, AFAICT - either way you have to not finish the payjoin protocol until the lightning side advances, you might as well just let the lightning side actually do the broadcast, right? |
Regarding the broadcasting, we should abide by the payjoin rules, which goes by the following:
Also I am not sure if we can sign and broadcast the psbt after we made changes to it and we dont own the inputs? Currently what I am doing is the following:
This will probably change once I go further in the PR.. |
I'm still confused why it needs to happen this way. Here's what I had in mind: We're a node that wants to send payment(s) via payjoin, and in doing so open an outbound channel with some unrelated channel counterparty. This seems like the most sensible case to focus on because its the case of a "client" wallet - if we're receiving payments we probably want to receive channels too. When we get to the point where we want to do this (ie we're ready to open a channel to the counterparty), we start by doing an Where did we differ - it wasn't entirely clear from your above which side we're talking about in each protocol. |
A Payjoin integration with
ldk-node
started here lightningdevkit/ldk-node#257 and there are a couple of things I discussed with tnull and we thought it would be good to bring the discussion up to here to see what everyone thinks.Our goal of integrating Payjoin with lightning is to allow users to create a channel with funds that live outside the node wallet.
In order to achieve the above goal, we need to implement the following functionality:
Funding Signed
phase.You can find a detailed diagram of the desired flow here lightningdevkit/ldk-node#257 (comment)
Two questions were raised in offline discussions:
FundingSigned
msg exchange and and send it back to the Payjoin sender, ie we dont wanna broadcast it ourselves even tho its an outbound channel. The question is how we want to allow that or is it possible already?cc @DanGould
The text was updated successfully, but these errors were encountered: