upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-10 00:03:32 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-10 00:03:32 +0000
commitbbdc68cd9a04cdabfa4a1fffd507048f555d5fa5 (patch)
tree547f67f4fbabf86947ef71e33340b32289650ae8 /src/sync
parentcdeb6f5ef6863fdd7d00b09ba778f80e19638a9d (diff)
fix: return error when negentropy has failures to enable REQ fallback
When negentropy sync times out or has other failures, it now properly returns Err() instead of Ok() with empty reconciliation. This ensures historic_sync increments failed_count and triggers fallback to REQ+EOSE instead of treating it as a successful sync with 0 events. Resolves issue where bootstrap relay timeouts were marked as complete instead of falling back to traditional sync.
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/relay_connection.rs18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/sync/relay_connection.rs b/src/sync/relay_connection.rs
index 5fabd10..f19abb9 100644
--- a/src/sync/relay_connection.rs
+++ b/src/sync/relay_connection.rs
@@ -527,11 +527,19 @@ impl RelayConnection {
527 self.nip77_supported 527 self.nip77_supported
528 .store(2, std::sync::atomic::Ordering::Relaxed); 528 .store(2, std::sync::atomic::Ordering::Relaxed);
529 529
530 tracing::debug!( 530 // Log warning only once per relay to avoid spam
531 relay = %self.url, 531 if !self
532 failures = ?output.failed, 532 .nip77_warning_logged
533 "Negentropy diff had failures (timeout usually means relay doesn't support NIP-77)" 533 .swap(true, std::sync::atomic::Ordering::Relaxed)
534 ); 534 {
535 tracing::warn!(
536 relay = %self.url,
537 failures = ?output.failed,
538 "Negentropy diff had failures (timeout usually means relay doesn't support NIP-77), will fall back to REQ+EOSE"
539 );
540 }
541
542 return Err(format!("Negentropy diff had failures: {:?}", output.failed));
535 } 543 }
536 544
537 Ok(reconciliation) 545 Ok(reconciliation)