From e1806540b5d905646b786e21a6060e4498e9aff1 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 9 Jan 2026 09:21:55 +0000 Subject: feat(sync): validate negentropy event receipt and retry missing events Add validation that all events requested by ID during negentropy sync are actually received from the relay. When events are missing: - Log detailed information (requested/received/missing counts and IDs) - Create retry subscriptions for missing events (chunked by 300) - Update batch to track only missing events in next round - Only complete batch after all events received or retry fails This handles relays that have limits on ID-based queries (e.g., max 150 events per query) by automatically retrying in smaller chunks. Also excludes purgatory and rejected announcement events from negentropy requests to avoid re-requesting events we know we can't/won't store. Note: Current implementation lacks retry limit - infinite loop protection needed (tracked as future work). --- src/sync/algorithms.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/sync/algorithms.rs') diff --git a/src/sync/algorithms.rs b/src/sync/algorithms.rs index f4b1f5c..4679986 100644 --- a/src/sync/algorithms.rs +++ b/src/sync/algorithms.rs @@ -402,6 +402,8 @@ mod tests { outstanding_subs: HashSet::new(), sync_method: SyncMethod::ReqEose, pagination_state: HashMap::new(), + requested_event_ids: None, + received_event_ids: None, }], ); @@ -514,6 +516,8 @@ mod tests { outstanding_subs: HashSet::new(), sync_method: SyncMethod::ReqEose, pagination_state: HashMap::new(), + requested_event_ids: None, + received_event_ids: None, }], ); -- cgit v1.2.3