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.
This commit is contained in:
DanConwayDev
2026-01-10 00:03:32 +00:00
parent cdeb6f5ef6
commit bbdc68cd9a
+13 -5
View File
@@ -527,11 +527,19 @@ impl RelayConnection {
self.nip77_supported
.store(2, std::sync::atomic::Ordering::Relaxed);
tracing::debug!(
relay = %self.url,
failures = ?output.failed,
"Negentropy diff had failures (timeout usually means relay doesn't support NIP-77)"
);
// Log warning only once per relay to avoid spam
if !self
.nip77_warning_logged
.swap(true, std::sync::atomic::Ordering::Relaxed)
{
tracing::warn!(
relay = %self.url,
failures = ?output.failed,
"Negentropy diff had failures (timeout usually means relay doesn't support NIP-77), will fall back to REQ+EOSE"
);
}
return Err(format!("Negentropy diff had failures: {:?}", output.failed));
}
Ok(reconciliation)