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

Part 4: offers for non-public nodes, and handling self-pay #7461

Merged
merged 12 commits into from
Jul 18, 2024

Conversation

rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Jul 10, 2024

Builds on #7456 (Merged!)

This handles the corner cases of self-pay, and invoice blinded paths which start from us (this latter is pretty icky, as we need to unwrap one layer which requires our private key, hence a new internal RPC). It also removes the now-unneeded sendonionmessage.

@rustyrussell rustyrussell added this to the v24.08 milestone Jul 10, 2024
@rustyrussell rustyrussell force-pushed the part4-corner-cases branch 2 times, most recently from bb98944 to 7b4f400 Compare July 17, 2024 07:16
On my local machine it can run into ratelimiting, because I miscounted the fetchinvoice
calls.

Signed-off-by: Rusty Russell <[email protected]>
For bolt12, we have blinded paths so we route to the head of the blinded
path, which may not be the same as the final payment destination.

This matters mainly for detecting self-pay.

Signed-off-by: Rusty Russell <[email protected]>
Don't refuse, this will happen if we are the head of the blinded path,
for example.

Signed-off-by: Rusty Russell <[email protected]>
I'm not sure about interface yet, so don't document.  It's ugly.

Signed-off-by: Rusty Russell <[email protected]>
Ideally, we would be able to submit a payment exactly as an incoming
HTLC would, but our forwarding and decoding logic is currently very
much tied to the HTLC.  It would be wonderful to detach that and
have an "injectonion" interface which was unwrapped like any other
(see "injectonionmessage") which would handle self-pay without any
special paths.

Since I'm not prepared to rewrite that all now, instead we use an
interface to decrypt the first hop if it's us, and use the remainder
of the blinded path.

Changelog-Fixed: plugins: pay can now pay a bolt12 invoice even if we, ourselves, are the head of the blinded path within it.
Signed-off-by: Rusty Russell <[email protected]>
We use this for invoices published by unannounced nodes: want
something very similar for offers, so generalize and expose it.

Signed-off-by: Rusty Russell <[email protected]>
This also lets us test offers and invoices work if we are the start of
the blinded path.

Changelog-Added: offers: automatically add a blinded path from a peer if we have no public channels, so unannounced nodes can have offers too.
Signed-off-by: Rusty Russell <[email protected]>
…ting invoice.

Changelog-Added: offers: we can now self-fetch and self-pay BOLT12 offers and invoices.
Signed-off-by: Rusty Russell <[email protected]>
We will want to use it in the pay plugin too.

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Added: Protocol: pay can now pay to bolt12 invoices if entry to blinded hop is specified as a short_channel_id (rather than node id).
Signed-off-by: Rusty Russell <[email protected]>
It was only ever expermental, so I don't feel bad about just removing it.

Signed-off-by: Rusty Russell <[email protected]>
Changelog-Removed: JSON-RPC: `sendonionmessage` (was experimental only, use `injectonionmessage`)
Copy link
Collaborator

@endothermicdev endothermicdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, I didn't realize sendonionmessage was being ripped out at the end of this. Blinded path handling and self-pay look solid.
ACK 13adccf

plugins/offers_invreq_hook.c Show resolved Hide resolved
@rustyrussell rustyrussell merged commit 3c04b6f into ElementsProject:master Jul 18, 2024
36 checks passed
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.

None yet

2 participants