mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
refactor: use mark_negentropy_unsupported() consistently
Refactor internal code to use the mark_negentropy_unsupported() method instead of direct field access for improved readability.
This commit is contained in:
@@ -282,9 +282,7 @@ impl RelayConnection {
|
||||
|| msg.contains("negentropy");
|
||||
|
||||
if is_negentropy_notice {
|
||||
// Mark relay as not supporting NIP-77
|
||||
self.nip77_supported
|
||||
.store(2, std::sync::atomic::Ordering::Relaxed);
|
||||
self.mark_negentropy_unsupported();
|
||||
|
||||
tracing::info!(
|
||||
relay = %url,
|
||||
@@ -478,13 +476,14 @@ impl RelayConnection {
|
||||
true
|
||||
}
|
||||
|
||||
/// Mark this relay as not supporting NIP-77 negentropy (for external callers)
|
||||
/// Mark this relay as not supporting NIP-77 negentropy
|
||||
///
|
||||
/// This is called by SyncManager when negentropy retry returns zero events,
|
||||
/// indicating the relay's negentropy implementation is broken. Future batches
|
||||
/// will skip negentropy and use REQ+EOSE directly.
|
||||
/// Called when we detect negentropy isn't working for this relay:
|
||||
/// - NOTICE message contains negentropy-related error
|
||||
/// - negentropy_sync_diff() fails
|
||||
/// - Negentropy retry returns zero events
|
||||
///
|
||||
/// Note: Internal code in this struct uses direct field access instead.
|
||||
/// Future batches will skip negentropy and use REQ+EOSE directly.
|
||||
pub fn mark_negentropy_unsupported(&self) {
|
||||
self.nip77_supported
|
||||
.store(2, std::sync::atomic::Ordering::Relaxed);
|
||||
@@ -576,9 +575,7 @@ impl RelayConnection {
|
||||
Ok(reconciliation)
|
||||
}
|
||||
Err(e) => {
|
||||
// Mark relay as not supporting NIP-77
|
||||
self.nip77_supported
|
||||
.store(2, std::sync::atomic::Ordering::Relaxed);
|
||||
self.mark_negentropy_unsupported();
|
||||
|
||||
// Log warning only once per relay to avoid spam
|
||||
if !self
|
||||
|
||||
Reference in New Issue
Block a user