aboutsummaryrefslogtreecommitdiffstats
path: root/src/api.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-15 09:52:18 -0700
committerAdam Soltys <[email protected]>2026-06-15 09:52:18 -0700
commit9ab7f898a02ecbafd7da511107cddf2fd5fe104d (patch)
tree922502921bfebe3f4d24df97cf47d64952c80aca /src/api.js
parent92b27e7d6de51ae178f068b079d3eec017689d85 (diff)
downloadcoinosv3-9ab7f898a02ecbafd7da511107cddf2fd5fe104d.tar.gz
coinosv3-9ab7f898a02ecbafd7da511107cddf2fd5fe104d.zip
Fix Max button, slash scan requests (429s), cache history locally
Max button: fill the amount field with the computed maximum (n inputs, 1 output, current fee rate) so it gives visible feedback instead of just blanking/disabling the field. Rate limits: eliminate look-ahead (gap limit 1 — stop at the first unused address, safe because we only ever expose one unused address at a time), query one address at a time (API concurrency 1, 400ms spacing across two backends), scan chains sequentially, and pause 500ms after each used address. An empty scan is now ~2-3 requests instead of ~10+. History cache: persist scanned state (addresses, utxos, txs, indices) in localStorage keyed by sha256(seed) — the seed itself is never stored. Re- importing the same seed in this browser shows the last-known balance/history instantly while a fresh scan runs. Cleared by nothing automatically (public chain data); different seeds get separate keys. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/api.js')
-rw-r--r--src/api.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/api.js b/src/api.js
index 43d2bae..3e10351 100644
--- a/src/api.js
+++ b/src/api.js
@@ -28,9 +28,10 @@ export class Api {
}));
this._rr = 0;
- // Global throttle.
- this._maxConcurrent = 2;
- this._minGapMs = 200;
+ // Global throttle: one request at a time, well spaced. Combined with
+ // round-robin across two backends this keeps each host's rate very low.
+ this._maxConcurrent = 1;
+ this._minGapMs = 400;
this._active = 0;
this._nextStart = 0;
this._queue = [];