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

Multiple InvoiceReceived events for single pay_for_offer call #3653

Open
benthecarman opened this issue Mar 7, 2025 · 4 comments
Open

Multiple InvoiceReceived events for single pay_for_offer call #3653

benthecarman opened this issue Mar 7, 2025 · 4 comments
Assignees

Comments

@benthecarman
Copy link
Contributor

benthecarman commented Mar 7, 2025

I had a simple unit test that would spin up 2 nodes and pay a bolt12 offer between them. My InvoiceReceived event handler was not idempotent and would throw if duplicates came in, this caused me to notice that I was receiving multiples of the same event. Found this when upgrading from 0.0.125 to 0.1.1. Can provide logs and code if more info is needed.

Edit: it seems send_payment_for_bolt12_invoice is not idempotent either so this would effect everyone using manually_handle_bolt12_invoices

@jkczyz
Copy link
Contributor

jkczyz commented Mar 7, 2025

Yeah, we need to check PendingOutboundPayment before generating that event.

We're currently looking into dropping manually_handle_bolt12_invoices and the InvoiceReceived event in favor of a different way of examining BOLT12 messages. Could you describe your use case for needing manually_handle_bolt12_invoices?

@jkczyz jkczyz assigned jkczyz and shaavan and unassigned jkczyz Mar 7, 2025
@vincenzopalazzo
Copy link
Contributor

Interested in this because I was planning to open an RFC PR to propose removing the ``

Due with #3593 we receive the invoice anyway through the PaymentSend event

@jkczyz
Copy link
Contributor

jkczyz commented Mar 7, 2025

Thinking about this more, we'll probably want to transition to PendingOutboundPayment::InvoiceReceived in this case, which is currently only used as an ephemeral state. And then allow paying an invoice in this state.

Interested in this because I was planning to open an RFC PR to propose removing the ``

Due with #3593 we receive the invoice anyway through the PaymentSend event

We are iterating on a couple ideas, namely #3412 and #3639.

@benthecarman
Copy link
Contributor Author

Could you describe your use case for needing manually_handle_bolt12_invoices?

It's so I can save the bolt12 invoice and track the payment

https://github.com/benthecarman/rld/blob/master/src/events.rs#L764

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

No branches or pull requests

4 participants