Skip to content

Multiple InvoiceReceived events for single pay_for_offer call #3653

Closed

Description

@benthecarman

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

Activity

  1. jkczyz commented on Mar 7, 2025

    @jkczyz
    Contributor

    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?

  2. assigned and unassigned on Mar 7, 2025
  3. vincenzopalazzo commented on Mar 7, 2025

    @vincenzopalazzo
    Member

    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

  4. jkczyz commented on Mar 7, 2025

    @jkczyz
    Contributor

    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.

  5. benthecarman commented on Mar 7, 2025

    @benthecarman
    ContributorAuthor

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions