-
Notifications
You must be signed in to change notification settings - Fork 386
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
[RFC] Implement a way to do BOLT 12 Proof of Payment #3593
base: main
Are you sure you want to change the base?
[RFC] Implement a way to do BOLT 12 Proof of Payment #3593
Conversation
c7e9e61
to
cc714ae
Compare
a5c211c
to
9cdbb44
Compare
9cdbb44
to
8f5dc5e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3593 +/- ##
==========================================
+ Coverage 88.51% 89.71% +1.19%
==========================================
Files 149 149
Lines 114968 126473 +11505
Branches 114968 126473 +11505
==========================================
+ Hits 101768 113467 +11699
+ Misses 10707 10609 -98
+ Partials 2493 2397 -96 ☔ View full report in Codecov by Sentry. |
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.
Thank you for picking this up! Sorry about the delay in review, not sure why this slipped through the cracks.
@@ -2291,6 +2305,7 @@ impl OutboundPayments { | |||
payment_metadata: None, // only used for retries, and we'll never retry on startup | |||
keysend_preimage: None, // only used for retries, and we'll never retry on startup | |||
invoice_request: None, // only used for retries, and we'll never retry on startup | |||
bolt12_invoice: None, // only used for retries, and we'll never retry on startup! TODO(vincenzopalazzo): double check this |
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.
Hmm, yea, we actually might want to store these somehow. Can happen in a later PR though.
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.
Ok so I will add a comment inside the main issue to track it down and I will open a followup PR in the next week! as I was planning for the DNS sec proof. Thanks
7da68f6
to
0e7b503
Compare
Thanks for the review @TheBlueMatt, I applied the suggestion in the review. In the meanwhile, I rebased on top of |
0e7b503
to
a4897fb
Compare
a4897fb
to
2c65d6a
Compare
lightning/src/ln/outbound_payment.rs
Outdated
@@ -1090,6 +1112,7 @@ impl OutboundPayments { | |||
.take() | |||
.ok_or(Bolt12PaymentError::UnexpectedInvoice)? | |||
.invoice_request, | |||
static_invoice: String::from("we should have the static invoice here"), |
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.
Yea, should be easy to pass it form the callsite.
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.
yep sorry I pushed the code but I was not happy for the approach, I am rolling back the static invoice work and see if I can come up with a clean approach today!
Thanks for the comments, tho!
9b72246
to
2c65d6a
Compare
Ok @TheBlueMatt this PR is really funny to work! I worked to clean up the PR a bit and divide the code to support both Bolt12 and static invoices. However, I am currently working on supporting the async payment functionality. As far as I understand, the code involving async payments is a bit tricky to support for the following reasons (code available 85c3f73). The async workflow is initialized with The only way I have to access the static invoice when passing it down inside
I would prefer the 3rd point, but this requires a follow-up PR to rework a little bit how the async payment is handled and I do not know if there is any plan for that,t or there is other code that will be depending on this architecture in the pipeline. Probably @valentinewallace will be interested in this conversation |
Generally we just copy and paste the impl with different cfg flags and go back and clean it up after we drop the cfg. I'll let @valentinewallace comment on the rest. |
Hey sorry I missed this tag. In #3618 right now we actually un-cfg-gate |
Yes, but in this case, we need to duplicate all the |
4364dc2
to
9d64585
Compare
We need to include static invoices in the public API as part of the onion messages we're adding for static invoice server support. Utilities to create these static invoices and other parts of the async receive API will remain cfg-gated for now. Generally, we can't totally avoid exposing half baked async receive support in the public API because OnionMessenger is parameterized by an async payments message handler, which can't be cfg-gated easily.
9d64585
to
87aec7e
Compare
This commit prepares the code to pass down the BOLT12 invoice inside the `PaymentSent` event. To achieve this, the `bolt12` field has been added to the `PendingOutboundPayment::Retryable` enum, allowing it to be attached to the `PaymentSent` event when the payment is completed. Link: lightningdevkit#3344 Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
4f9d1ad
to
48ebbde
Compare
48ebbde
to
734c955
Compare
To enable proof of payment, we need to share the bolt12 invoice with the library user. This is already possible if we `manually_handle_bolt12_invoices`, but this approach requires a significant amount of work from the user. This commit adds the bolt12 invoice to the PaymentSend event when the payment is completed. This allows the user to always have the option to perform proof of payment. Link: lightningdevkit#3344 Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
…Received Inject the static invoice inside the PendingOutboundPayment::StaticInvoiceReceived to allow to use the static invoice inside the PendingOutboundPayment::PaymentReceived. Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
734c955
to
525c01e
Compare
@@ -379,6 +379,7 @@ impl StaticInvoice { | |||
self.signature | |||
} | |||
|
|||
#[allow(unused)] // TODO: remove this once we remove the `async_payments` cfg flag |
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.
looks like that cherry-picking does this, so will fix when the Ci will report all the failure!
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.
I’ve pushed the first clean version of this PR. This should accomplish what we’re looking for with minimal changes to the static invoice workflow.
It still needs some work to pass the CI completely, but the issues appear to be unrelated to the PR itself and require further investigation. I’m going to grab some coffee while waiting for the CI to finish. In the meantime, this should be ready for review if anyone has the time.
This is already possible if we
manually_handle_bolt12_invoices
, butthis approach requires a significant amount of work from the user.
This commit adds the bolt12 invoice to the PaymentSend event when
the payment is completed. This always gives the user the option to
provide proof of payment.
I am opening this up for an initial review, but I need to look inside the
DNSSECProof
to add this proof, butprobably be also a follow-up PR
Opening in draft for now to make the CI happyFixes: #3344