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

renepay: Support for BOLT12 #7985

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

Lagrang3
Copy link
Collaborator

@Lagrang3 Lagrang3 commented Jan 10, 2025

Adding support for BOLT12 in renepay.

Closes #6609

We compute routes to blinded paths by using a fake node as destination and then linking the entry point of every blinded path to the destination with a fake channel that represents the use of that blinded path. The same way that xpay does.

To send the payment we had to change from sendpay to sendonion. We could have used injectpaymentonion but since the injectpaymentonion does not yet support passing shared_secrets nor the destination id we preferred sendonion, also sendonion is more in tune with renepay design of sending the onions and wait for responses in a notification as opposed to xpay that reacts as soon as injectpaymentonion returns with success or failure.

@Lagrang3 Lagrang3 force-pushed the renepay-bolt12 branch 6 times, most recently from 5668dfc to 94be50d Compare January 17, 2025 11:47
@Lagrang3 Lagrang3 force-pushed the renepay-bolt12 branch 5 times, most recently from 55ca735 to 4dff4a8 Compare January 20, 2025 18:29
A first step towards supporting bolt12 invoices and blinded paths.

Changelog-None

Signed-off-by: Lagrang3 <[email protected]>
Enable routing through blinded paths using fake channels in local
gossmods.

Changelog-None

Signed-off-by: Lagrang3 <[email protected]>
Add an rpc to renepay that is similar to sendpay that
handles BOLT11 and BOLT12 payments.
This is not the most elegant solution but it is a workaround
until we implement it into lightningd which has more development
friction.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Changing route.amount to route.amount_deliver
for clarity. This variable hold the value that
the route delivers to destination.

Changelog-None

Signed-off-by: Lagrang3 <[email protected]>
Use renesendpay to send the payment allowing to pay to BOLT12 invoices
from a higher level interface.

Changelog-Add: renepay: Add support for BOLT12 payments

Signed-off-by: Lagrang3 <[email protected]>
@Lagrang3 Lagrang3 force-pushed the renepay-bolt12 branch 3 times, most recently from 081bfeb to 895652e Compare January 27, 2025 09:19
Fix error handling since we moved from sendpay to sendonion rpc.
With sendonion once a route fails we don't get the scid and node_id that
failed along the route, so we have to deduce those from our own internal
data.

Changelog-None

Signed-off-by: Lagrang3 <[email protected]>
sendonion RPC does not allow to set the total amount in lightningd's
wallet, therefore it mixing sendpay and sendonion payment parts would
not work. That means for the time being we cannot complete a payment
initialized with sendpay until we add a total_amount parameter to
sendonion.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Refactor create_onion function, now we could use the same function to
build onions for sendonion and injectpaymentonion.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Collect the shared secrets when making a payment request.
We would need this if we use injectpaymentonion instead of sendonion.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Use injectpaymentonion for payments with |routes|=0,
ie. self-payments and blinded paths where our node is
the first node in the blinded path.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
Always use a fake destination node, the self-payments are no longer a
corner case for the routing problem in this way. Also it is ok for
get_routes to return routes with zero length.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
When paying with injectpaymentonion we need to manually decode the error
from the onion.

Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
@Lagrang3 Lagrang3 marked this pull request as ready for review January 29, 2025 09:40
Changelog-None.

Signed-off-by: Lagrang3 <[email protected]>
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.

Support blinded paths (i.e. bolt12) in renepay
1 participant