diff options
| author | Adam Soltys <[email protected]> | 2026-09-05 00:36:32 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-05 00:36:32 -0700 |
| commit | 287fdb2b14b48d769e43a223c5c33049ff470880 (patch) | |
| tree | cbba0d961310bbc530782c556bc066b447cb8a28 | |
| parent | 917633aeeab8518af9e52a16532d8485dbd62e2a (diff) | |
| download | coinos-server-287fdb2b14b48d769e43a223c5c33049ff470880.tar.gz coinos-server-287fdb2b14b48d769e43a223c5c33049ff470880.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMi2Y1oKPZ3TeeFmLej47y
| -rw-r--r-- | lib/lightning.ts | 9 |
1 files changed, 9 insertions, 0 deletions
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); |
