mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
NIP-03 OpenTimestamps attestations (kind 1040) were stored loosely in the main note cache and found via a full-cache scan, with their blockchain verdicts held in a separate, id-keyed VerificationStateCache LRU. Nothing tied either to the lifecycle of the note being timestamped, so a deleted/pruned note leaked its attestations, and consume(OtsEvent) invalidated the attestation's own (observer-less) flow instead of the target's — so a live-arriving proof never pinged the target's UI. Mirror the recent edits→Note migration: - Note gains a `timestamps` child collection (like `edits`/`reactions`), wired into clearChildLinks/removeNote, so an attestation survives exactly as long as its target and is collected when the target is pruned or deleted. - consume(OtsEvent) anchors the proof on its target via the `e` tag and invalidates the target's `ots` flow; unlinkAndRemove detaches it symmetrically. - Each attestation memoizes its own verdict in `Note.otsVerification`, so the result shares the note's lifecycle. This replaces VerificationStateCache (deleted) and the full-cache scan: the OTS pill now folds `note.timestamps` via the new Note.earliestOtsVerifiedTime / cacheVerifyOts helpers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014D5fenZbAhCbDiwv7Rtpvj