aboutsummaryrefslogtreecommitdiffstats
path: root/index.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-13 14:21:44 -0700
committerAdam Soltys <[email protected]>2026-06-13 14:21:44 -0700
commitca28c19fe26d3f81ae62d2d3f0dc8b175849a9a8 (patch)
tree2be3077a7e59ce1645b9209b52d507735a8c55d5 /index.ts
parent43427afe5b0b16d887163bd788360ac29105d69c (diff)
downloadcoinos-server-ca28c19fe26d3f81ae62d2d3f0dc8b175849a9a8.tar.gz
coinos-server-ca28c19fe26d3f81ae62d2d3f0dc8b175849a9a8.zip
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> (ref = preimage) and bail if already claimed. Also disable the /replay route that triggered it. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'index.ts')
-rw-r--r--index.ts2
1 files changed, 1 insertions, 1 deletions
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({});
});