diff options
| author | Adam Soltys <[email protected]> | 2026-12-02 13:45:51 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-12-02 13:45:51 -0700 |
| commit | a07e326bc9dae4a3df02ce8f08cb4f71f094392e (patch) | |
| tree | 6c86c1e050db7073eaf6a6a33b2b9694b74a524b /routes | |
| parent | 74939c517b51a08e88106e10b93aafc9988cdb98 (diff) | |
| download | coinos-server-a07e326bc9dae4a3df02ce8f08cb4f71f094392e.tar.gz coinos-server-a07e326bc9dae4a3df02ce8f08cb4f71f094392e.zip | |
rate limits: key per-account limits on the user, add them to on-chain sends
The token-keyed limits on /lightning/quote and GET /invoice/:id used the
first 50 characters of the Authorization header, which are the same for
every JWT, so all signed-in users shared one bucket. /lightning/quote now
limits per user id (checked after auth), and GET /invoice/:id per IP like
the other invoice routes. /bitcoin/fee and /bitcoin/send get a per-user
limit of 10 a minute, and repeated fee-estimate failures log once per user
per 10 minutes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6SSfVopM1ZzXKZmLYU
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/routes/payments.ts b/routes/payments.ts index 80ef56bb..011aabb4 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -747,13 +747,18 @@ export default { try { res.send(await build({ ...body, user })); } catch (e) { - warn( - "problem estimating fee", - e.message, - user.username, - body.amount, - body.address, - ); + // Bots retry the same doomed withdrawal every few seconds; log once + // per user per 10 minutes. + const n = quiet(`feefail:${user.id}`); + if (n !== null) + warn( + "problem estimating fee", + e.message, + user.username, + body.amount, + body.address, + suppressed(n), + ); let msg = e.message; if (msg.includes("500")) msg = ""; bail(res, `Failed to prepare transaction ${msg}`); |
