Skip to content

[RFC] events: add InvoiceSent event for BOLT12 payee #3853

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

Conversation

vincenzopalazzo
Copy link
Contributor

When processing BOLT12 payments, there was an asymmetry in the API where payer nodes receive InvoiceReceived events but payee nodes had no way to access the invoices they created and sent as far I know.

This commit adds:

  • New Event::InvoiceSent event generated when a BOLT12 invoice is created and sent in response to an invoice request
  • New notify_bolt12_invoice_sent configuration parameter in UserConfig (defaults to false) to enable/disable the event generation

The InvoiceSent event provides the payee with access to:

  • The created BOLT12 invoice
  • The context of the BlindedMessagePath
  • The payment hash and payment secret

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jun 12, 2025

I've assigned @jkczyz as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@vincenzopalazzo vincenzopalazzo force-pushed the macros/notify-for-bolt12invoice-sent branch from 93454f3 to 6c4a8ea Compare June 12, 2025 17:27
When processing BOLT12 payments, there was an asymmetry in the API where payer nodes receive `InvoiceReceived` events but payee nodes had no way to access the invoices they created and sent as far I know.

This commit adds:
- New `Event::InvoiceSent` event generated when a BOLT12 invoice is created and sent in response to an invoice request
- New `notify_bolt12_invoice_sent` configuration parameter in UserConfig (defaults to false) to enable/disable the event generation

The InvoiceSent event provides the payee with access to:
- The created BOLT12 invoice
- The context of the BlindedMessagePath
- The payment hash and payment secret

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@vincenzopalazzo vincenzopalazzo force-pushed the macros/notify-for-bolt12invoice-sent branch from 6c4a8ea to ee2f11c Compare June 12, 2025 17:29
@vincenzopalazzo vincenzopalazzo changed the title [RFC] events: add InvoiceSent event for BOLT12 payee symmetry [RFC] events: add InvoiceSent event for BOLT12 payee Jun 12, 2025
@ldk-reviews-bot ldk-reviews-bot requested a review from jkczyz June 12, 2025 17:36
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 89.88%. Comparing base (217a5b0) to head (ee2f11c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/events/mod.rs 0.00% 18 Missing ⚠️
lightning/src/ln/channelmanager.rs 43.75% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3853      +/-   ##
==========================================
- Coverage   89.93%   89.88%   -0.06%     
==========================================
  Files         163      163              
  Lines      131276   131307      +31     
  Branches   131276   131307      +31     
==========================================
- Hits       118062   118022      -40     
- Misses      10529    10600      +71     
  Partials     2685     2685              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TheBlueMatt
Copy link
Collaborator

Rather than doing this via the Event pipeline, we should figure out how to do it via the Flow that we added recently, I think.

When we first got the request to manually intercept payments between receiving the Invoice and sending the payment (for fedi), we added it via events, which was okay, but we tend to lean on the event pipeline too much generally and specifically for offers we have other flexibility concerns. Instead, we are trying to push things through the new flow, which can be configured separately.

I haven't had a chance to look at it yet, but #3833 seems to be trying to accomplish the same thing but via the new pipeline.

@vincenzopalazzo
Copy link
Contributor Author

Thanks for looking into it! I am looking into #3833 now! Closing it for now!

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