From 287fdb2b14b48d769e43a223c5c33049ff470880 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 5 Sep 2026 00:36:32 -0700 Subject: ln listener: skip a settlement whose account is gone before crediting credit() now returns without writing for a missing user, but the listener's persistence check after credit() then threw and kept the cursor stuck. Check the account up front and skip like an unknown invoice, recording the preimage in `missing`. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01VMi2Y1oKPZ3TeeFmLej47y --- lib/lightning.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib') diff --git a/lib/lightning.ts b/lib/lightning.ts index dd26e6ca..48410ffe 100644 --- a/lib/lightning.ts +++ b/lib/lightning.ts @@ -112,6 +112,15 @@ export async function listenForLightning() { const invoice = await getInvoice(bolt11 ?? local_offer_id ?? bolt12); if (!invoice) return warn("received lightning with no invoice", bolt11); + // A deleted account's invoice or bolt12 offer can still be paid (OCEAN + // payouts to a deleted user's offer, 2026-09-05). Nothing can be + // credited, and the post-credit persistence check below would throw and + // wedge the listener on this settlement forever. Record and skip. + if (!(await getUser(invoice.uid))) { + await db.sAdd("missing", preimage); + return warn("received lightning for missing user", invoice.uid, bolt11 ?? bolt12, received); + } + const p = await getPayment(bolt11 || bolt12); if (p) return warn("already processed", bolt11 || bolt12); -- cgit v1.2.3