diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 09:21:55 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 09:21:55 +0000 |
| commit | e1806540b5d905646b786e21a6060e4498e9aff1 (patch) | |
| tree | f9a9745484772351e5a21ee16600ab064a15bcd5 /src/sync/algorithms.rs | |
| parent | 5eb736e1184e313efa65237bf1973dee21afb43f (diff) | |
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).
Diffstat (limited to 'src/sync/algorithms.rs')
| -rw-r--r-- | src/sync/algorithms.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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 { | |||
| 402 | outstanding_subs: HashSet::new(), | 402 | outstanding_subs: HashSet::new(), |
| 403 | sync_method: SyncMethod::ReqEose, | 403 | sync_method: SyncMethod::ReqEose, |
| 404 | pagination_state: HashMap::new(), | 404 | pagination_state: HashMap::new(), |
| 405 | requested_event_ids: None, | ||
| 406 | received_event_ids: None, | ||
| 405 | }], | 407 | }], |
| 406 | ); | 408 | ); |
| 407 | 409 | ||
| @@ -514,6 +516,8 @@ mod tests { | |||
| 514 | outstanding_subs: HashSet::new(), | 516 | outstanding_subs: HashSet::new(), |
| 515 | sync_method: SyncMethod::ReqEose, | 517 | sync_method: SyncMethod::ReqEose, |
| 516 | pagination_state: HashMap::new(), | 518 | pagination_state: HashMap::new(), |
| 519 | requested_event_ids: None, | ||
| 520 | received_event_ids: None, | ||
| 517 | }], | 521 | }], |
| 518 | ); | 522 | ); |
| 519 | 523 | ||