Manual capture: decide held payments that arrived while no event stream was open #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
LDK Server does not replay
PaymentClaimableevents. The README says a payment that arrives while the listener is disconnected "never becomes an authorization", and the node fails its HTLC at the claim deadline. For a payer, that means funds are locked for hours and then refunded, even though the service could have decided immediately. This is realistic: a restart or deploy while a payment is in flight is enough.Suggestion
After every (re)subscription, page through
ListPaymentsand treat each inbound BOLT11 payment with statusPendingwhose hash matches a stored hold as aClaimable:payment_id: the record'spayment_id;hash: the hash frompayment_kind::Bolt11;amount_msat.Then pass it through the same
observe()path. At the pinned LDK Node revision, a hold-invoice payment record is created only when the HTLCs arrive (event.rs,PaymentClaimablehandling), so a pending inbound record for one of our hashes means the payment is held now.Notes:
ListPaymentsis not filtered by status, so cap the number of pages and document that a very large node may not be scanned completely.observe()must stay idempotent for a payment that already has an authorization.npub.cash does this on every reconnect. It was checked on regtest with two LDK Server nodes: a payment made while the service was stopped was claimed on restart.