AuthCaptureEscrow logs into a durable payment feed. A WebSocket subscription provides low-latency wakeups, while an overlapping confirmed backfill supplies the canonical source of truth after disconnects or reorgs.
Demo
Subscribe and Backfill
Watch the v1.1.0 escrow forPaymentAuthorized, PaymentCharged, PaymentCaptured, PaymentVoided, PaymentReclaimed, and PaymentRefunded. They all share the indexed paymentInfoHash.
TypeScript worker
replaceRange as one database transaction: remove rows in the overlap, insert the current canonical logs, rebuild affected payment state, and advance the cursor only after all writes succeed.
After reconnects or short reorgs, the overlap scan converges on canonical protocol events without applying one log twice.
See Also
Verify a Payment
Validate each candidate event against its order.
Reconcile Payments
Produce charge, capture, fee, and refund rows.