docs(snapshot): dedup-tie-break dokumentiert

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jörg Lohrer 2026-04-28 08:21:00 +02:00
parent 63b68411e4
commit 49c740d908
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,8 @@ import type { SignedEvent } from './types.ts'
export function dedupByDtag(events: SignedEvent[]): SignedEvent[] { export function dedupByDtag(events: SignedEvent[]): SignedEvent[] {
const byDtag = new Map<string, SignedEvent>() const byDtag = new Map<string, SignedEvent>()
// Bei gleicher created_at gewinnt das zuerst gesehene event (relay-delivery-
// reihenfolge ist nicht-deterministisch, equal-timestamp = aequivalent).
for (const ev of events) { for (const ev of events) {
const d = ev.tags.find((t) => t[0] === 'd')?.[1] const d = ev.tags.find((t) => t[0] === 'd')?.[1]
if (!d) continue if (!d) continue