LSPS2 service event handling isn't idempotent
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.
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.
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.
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 https://github.com/lightningdevkit/rust-lightning/pull/4160 . So now arguably you might expect a Duplicate error if there already is a corresponding entry.
Oh, right, I forgot about that PR. Ugh, yea, maybe indeed.