Registry Mirror
Skip to content

LSPS2 service event handling isn't idempotent #4209

Open

Description

@TheBlueMatt

Event handlers in LDK are expected to always be idempotent, but LSPS2 service doesn't appear to be. eg once we get to PaymentQueue::add_htlc we debug_assert that an HTLC with the same intercept id isn't already present, but it definitely could be. There's probably other instances.

Activity

  1. added this to the 0.3 milestone on Nov 5, 2025
  2. tnull commented on Nov 6, 2025

    @tnull
    Contributor

    Hmm, yeah, event replaying can be tricky. To handle this we probably need to error out when we detect a duplicate intercept SCID there, but to communicate this to the user we first need #4074.

  3. TheBlueMatt commented on Nov 6, 2025

    @TheBlueMatt
    CollaboratorAuthor

    A duplicate event isn't an error, though, its an expected condition. An error there might imply that the dev should return an error in the event handler, which will result in an infinite loop. IMO we should return success on a replayed event.

  4. tnull commented on Nov 6, 2025

    @tnull
    Contributor

    A duplicate event isn't an error, though, its an expected condition. An error there might imply that the dev should return an error in the event handler, which will result in an infinite loop. IMO we should return success on a replayed event.

    Well, we just diverged from this model of 'just continue if expected' error handling with #4160 . So now arguably you might expect a Duplicate error if there already is a corresponding entry.

  5. TheBlueMatt commented on Nov 6, 2025

    @TheBlueMatt
    CollaboratorAuthor

    Oh, right, I forgot about that PR. Ugh, yea, maybe indeed.

  6. modified the milestones: 0.3, 0.4 on Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions