-
Notifications
You must be signed in to change notification settings - Fork 912
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
Prevent pay from accepting a zero-length route (self-payments) #4379
Conversation
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.
Ack d474fb6
Changelog-Fixed: pay: Payments with an empty route (self-payment) are now aborted.
This duplicates the check in libplugin-pay.c, with a more concise error message. Both are needed since pay may not be the only entrypoint.
How about self-payments that aren't zero-length route, but still come back to same node? Is that possible? |
That is totally possible, and is used in some plugins (rebalance) 👍 |
How come it can't find a path internally that isn't zero length? Currently my wallet application code checks if node ID is the same as my apps, and then finds a circular route itself, but cumbersome and prone to errors.. But a fine workaround if nothing else works out the box. |
Hm? I don't quite follow what you're trying to achieve. Zero-length routes by definition are no-ops, hence they'll not affect any channels balances. Going for a circular route however is an operation that'll cost fees, hence we shouldn't replace a zero-length route with a circular route. |
The solution I'm going with to settle payments from my wallet to my wallet (same c-lightning node), is going via a circular route that I set up with my own nodes (zero fees). Ideally the node would fulfill invoices issued by itself with a zero length route (no extra nodes, no fees), but since this is not possible, what's the next best solution? |
@cdecker I'm assuming this is a pretty common thing people deal with with core-ln. Am I doing it the wrong way? |
Why would that be a common occurence? If you are the recipient why even create the invoice at all, and then pay it via a circular route? The funds are already at the destination and any actual routing will incur in fees. |
Because custodial app users will often be paying each other and it adds complexity to handle some transactions locally and send outward transactions via the lightning network. I'm pretty sure CoinCorner uses circular routes as well for self payments. |
As pointed out by #4345 we lost the check for zero-length routes in the
pay
plugin somewhere along the lines:gossipd.getroute
refused to generate them,gossmap
is happy to return an empty result, which is more correct, but also causes this regression, since we implicitly assumed that the route would never be empty and just accessp->route[0]
without checking.While I'd like to make self-payments supported, there is currently no way of mapping a payment that doesn't result in HTLCs to a successful attempt, thus disabling self-payments and being verbose about it is the next best thing.
Note: the original issue arose during an attempt to rebalance using the
pay
plugin, which cannot possibly work, and the rebalance plugin should be used instead.Fixes #4345