diff options
| author | Adam Soltys <[email protected]> | 2026-07-30 23:47:03 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-07-30 23:47:03 -0700 |
| commit | c264f12ded66f60ab137d05a6e2449f17c98ad68 (patch) | |
| tree | fdb1e79bb1983fce89a60a2c434d48d42980e930 /src/style.css | |
| parent | 6713f8d4e55db8d5344684b08b062cc9129ef6b0 (diff) | |
| download | coinosv3-c264f12ded66f60ab137d05a6e2449f17c98ad68.tar.gz coinosv3-c264f12ded66f60ab137d05a6e2449f17c98ad68.zip | |
Fix silent-payment catch-up pegging the CPU (both threads)
A wallet a few thousand blocks behind gets the whole scan window from the
indexer at once (~1M tweaks over ~3900 mainnet blocks). The catch-up loop
chunked by 100 BLOCKS, but the cost is one EC point-multiply per TWEAK and
mainnet blocks are wildly uneven (up to 2565 tweaks each) — so a 100-block
chunk could be ~25k tweaks, seconds of work that blew the worker's 30s
timeout. On timeout the caller ran the SAME chunk inline on the main thread
while the orphaned worker kept grinding it, pegging both threads and
freezing the visible tab for the whole ~20min catch-up.
Two fixes:
- Chunk by tweak count (budget 2000, always ≥1 block) instead of block
count, so every worker call stays sub-second regardless of block density.
Verified against live mainnet data: max chunk drops from ~25k tweaks to
~2.8k (~850ms, <3% of the timeout).
- On a worker-call timeout, TERMINATE the worker instead of leaving it
grinding the orphaned request behind the caller's inline fallback — that
double-grind was the both-threads-pegged symptom. _ensureSpWorker respawns
a fresh worker on the next call.
Diagnosed via CDP CPU profiling of the live tab (95% self-time in
_spHitBlocks -> _spCandidate -> secp256k1 wNAF/precompute).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Diffstat (limited to 'src/style.css')
0 files changed, 0 insertions, 0 deletions
