aboutsummaryrefslogtreecommitdiffstats
path: root/src/ark/validate.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-07-31 00:15:59 -0700
committerAdam Soltys <[email protected]>2026-07-31 00:15:59 -0700
commit6dc7f9f89a071e43de77bf6dd82cf8d4012ce8c3 (patch)
tree342e92453a8554e18e5c3fbab5dfcac90e65b252 /src/ark/validate.js
parentc264f12ded66f60ab137d05a6e2449f17c98ad68 (diff)
downloadcoinosv3-6dc7f9f89a071e43de77bf6dd82cf8d4012ce8c3.tar.gz
coinosv3-6dc7f9f89a071e43de77bf6dd82cf8d4012ce8c3.zip
Sync silent-payment scan across devices so the catch-up runs once
SP state (lastSpScan watermark + found spUtxos) was in the nostr snapshot but, unlike Ark/gifts, its cache extension wasn't mergeAlways — so it only applied via the newest full snapshot at load time, last-writer-wins. The watermark could regress (a device behind on SP, or mid-rescan, publishing a newer snapshot would reset another device's watermark), so every device tended to re-grind the ~1M-tweak backlog independently. Make it a commutative merge like Ark: - mergeAlways: true, so it merges live and from older snapshots too. - lastSpScan takes the MAX (monotonic high-water mark, never regresses) — this is what makes the block catch-up run once across all devices. - spUtxos is an additive union by outpoint; a coin we already track is never mutated, and spend detection stays each device's own job (_refreshSpUtxos drops backend-spent coins), so stale merged-in coins self-heal on refresh. - Anti-entropy: republish our superset when we know more, guarded so it stops once devices converge. A manual rescan still works — it forces from=1 synchronously (no await before capturing it), so a concurrent max-merge can't sabotage the re-scan. Verified with a merge unit test driving the real extension (max/union/converge). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Diffstat (limited to 'src/ark/validate.js')
0 files changed, 0 insertions, 0 deletions