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

routing+invoices: allow multi-part payment probes #4219

Open
joostjager opened this issue Apr 23, 2020 · 3 comments
Open

routing+invoices: allow multi-part payment probes #4219

joostjager opened this issue Apr 23, 2020 · 3 comments
Labels
brainstorming Long term ideas/discussion/requests for feedback mpp P3 might get fixed, nice to have payments Related to invoices/payments

Comments

@joostjager
Copy link
Contributor

Since #3156 it is possible to probe destinations before paying to get an accurate fee estimate upfront.

For single-shot payments can be done by sending a payment with an unknown payment hash and inspecting the returned failure. If it originates from the final destination, the route is deemed to be valid. Following through with the real payment is very likely to succeed.

For multi-part payments, it isn't that simple. Ideally you want to be sure that the selected routes can carry all parts at the same time. Because that is what the receiver will do. They will hold on to every part until the set is complete. However, if you use the single-shot probing method described above, htlcs will already be cancelled back before the set is complete. So the set may complete sequentially, but still fail when the real payment is executed.

The simplest example of this is a 20 sat channel when you need to pay 40 sat. It isn't possible. But if you probe two times 20, it looks as if it is possible.

So what is needed is a way to get the receiver to hold on to the payments until the set is complete and then cancel.

@joostjager
Copy link
Contributor Author

One way to do it may be to add a custom tlv record that signals probe. In that case, the receiver will cancel the set with a new failure code MPP_PROBE_SUCCESS.

Question is whether it is a problem to probe with the real payment hash. You'd need to trust the receiver that they don't take the probe as the real payment. It may not be the end of the world if they do. Also how to find out whether they support the new probe tlv record? Maybe the probes can use unknown hashes, but inside the probe tlv, there is the real payment hash. The htlc aren't locked to that, so can never be settled, but the invoice is still referenced. Alternatively use the payment address to reference the invoice.

@Roasbeef Roasbeef added brainstorming Long term ideas/discussion/requests for feedback mpp payments Related to invoices/payments labels Apr 27, 2020
@joostjager
Copy link
Contributor Author

Latest insight is to use a spontaneous multi-part payment (lightning/bolts#658) to do the probing.

@Roasbeef
Copy link
Member

Possible now via AMP, but not yet manifested on the RPC interface. An easy way to do this, would be to create a new first-class probing API that always attempts to send an invalid share as the "last" shard. Alternatively, we can use the other mechanism that instead

@Roasbeef Roasbeef added this to the v0.15.0 milestone Aug 31, 2021
@Roasbeef Roasbeef modified the milestones: v0.15.0, v0.16.0 Mar 7, 2022
@Roasbeef Roasbeef modified the milestones: v0.16.0, v0.17.0 Aug 23, 2022
@saubyk saubyk added the P3 might get fixed, nice to have label Aug 8, 2023
@saubyk saubyk removed this from the Low Priority milestone Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brainstorming Long term ideas/discussion/requests for feedback mpp P3 might get fixed, nice to have payments Related to invoices/payments
Projects
None yet
Development

No branches or pull requests

3 participants