diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-12 10:09:47 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-12 10:20:42 +0000 |
| commit | de07e31fad60f9c68a08807cde17ff81d8371a65 (patch) | |
| tree | 1c670ff38f6702b6e437877049038fbbf3281f97 /docs | |
| parent | 307c380a91a3575ab2266ed08427d24c7b2d016e (diff) | |
fix: unify sync state tracking for negentropy and REQ+EOSE paths
When negentropy (NIP-77) sync was enabled, the RelaySyncIndex was never
updated to reflect historical sync completion. This caused the three-way
diff algorithm in compute_actions() to malfunction, leading to:
- Repeated sync attempts for the same items
- Incorrect filter counting for consolidation
- Potential premature relay disconnection
This fix unifies both sync paths (REQ+EOSE and Negentropy) through a
consistent PendingBatch flow:
1. Added SyncMethod enum to distinguish between sync types
2. Updated PendingBatch struct to include sync_method field
3. Extracted confirm_batch() method for unified batch confirmation
4. Modified negentropy_sync_and_process() to:
- Create a PendingBatch before sync
- Add batch to pending_sync_index
- On success: Remove batch and call confirm_batch()
- On failure: Remove batch without confirming
The confirm_batch() method moves repos and root_events from the batch
to the RelayState.repos and RelayState.root_events, ensuring the
three-way diff works correctly regardless of sync method.
Closes: negentropy-sync-state-tracking.md
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions