From ca28c19fe26d3f81ae62d2d3f0dc8b175849a9a8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 13 Jun 2026 14:21:44 -0700 Subject: payments: guard /replay double-credit race with SET NX idempotency getPayment() pre-check in the lightning listener/replay isn't atomic, so concurrent re-credits of the same settlement each ran incrBy. Claim each lightning/bolt12 settlement with an atomic SET NX on credited: (ref = preimage) and bail if already claimed. Also disable the /replay route that triggered it. Co-Authored-By: Claude Opus 4.8 (1M context) --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'index.ts') diff --git a/index.ts b/index.ts index 793bf2f8..3b90d32b 100644 --- a/index.ts +++ b/index.ts @@ -187,7 +187,7 @@ app.post("/melt", auth, ecash.melt); app.post("/ecash/:id", ecash.receive); app.get("/replay/:index", (req, res) => { - replay(req.params.index); + // replay(req.params.index); res.send({}); }); -- cgit v1.2.3