Skip to content

storage: store the bolt12invoice invoice #563

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

vincenzopalazzo
Copy link
Contributor

Based on #462

Review only the commits a88e206

This commit is leveraging the feature implemented in lightningdevkit/rust-lightning#3593 to implement proof of payment.

This is really useful when LDK-node is going to be used on the side of other lightning nodes and the backend wants to know about the bolt12 invoice.

tnull and others added 16 commits June 3, 2025 14:00
.. as having them in two places doesn't make sense
.. we now apply the LSPS2 client-side overrides on a per-counterparty
basis, not as soon as we act as an LSP client
.. we implement the `async` version of `ChangeDestinationSource`, and,
to make all involved objects `Send`, we drop the `Deref` generics for
concrete `Arc`s everywhere.
This commit enhances the BOLT12 payment storage capabilities by adding
support for storing the actual BOLT12 invoice along with payment details.

We modify the following components:
- Added `bolt12_invoice` field to `PaymentKind::Bolt12Offer` and
  `PaymentKind::Bolt12Refund` variants in the payment store
- Updated event handling in `event.rs` to capture and store the
  BOLT12 invoice when payments are processed
- Modified BOLT12 payment creation logic to initialize the new field
- Enhanced payment update mechanism to handle BOLT12 invoice updates
- Added comprehensive test coverage for the new invoice storage feature

This improvement allows for proof of payment and to access the BOLT12
invoice details.

Signed-off-by: Vincenzo Palazzo <[email protected]>
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

Copy link
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

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

So, while I'd be open to expose the paid invoice, e.g, via the PaymentSuccessful event, I don't think we'd want to store it in the payment store. Post-#425 we might be able to add it in the payment metadata store.

Maybe it would be cleanest if you applied the approach in this PR to your fork, and then we go the payment-metadata-store route once it becomes unblocked?

@vincenzopalazzo
Copy link
Contributor Author

So, while I'd be open to exposing the paid invoice, e.g, via the PaymentSuccessful event

This makes sense to me too, and looks like the easy approach too, without touching the storage.

Maybe it would be cleanest if you applied the approach in this PR to your fork, and then we go the payment-metadata-store route once it becomes unblocked?

Yeah makes super sense! I can keep this PR open in draft, and then you will close it when it is ready on the mainline? or just follow up with me if you want that I will modify the PR to apply the new behaviour?

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.

3 participants