diff options
Diffstat (limited to 'src/sync/relay_connection.rs')
| -rw-r--r-- | src/sync/relay_connection.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/sync/relay_connection.rs b/src/sync/relay_connection.rs index 99fc4ea..5bc0fa3 100644 --- a/src/sync/relay_connection.rs +++ b/src/sync/relay_connection.rs | |||
| @@ -282,9 +282,7 @@ impl RelayConnection { | |||
| 282 | || msg.contains("negentropy"); | 282 | || msg.contains("negentropy"); |
| 283 | 283 | ||
| 284 | if is_negentropy_notice { | 284 | if is_negentropy_notice { |
| 285 | // Mark relay as not supporting NIP-77 | 285 | self.mark_negentropy_unsupported(); |
| 286 | self.nip77_supported | ||
| 287 | .store(2, std::sync::atomic::Ordering::Relaxed); | ||
| 288 | 286 | ||
| 289 | tracing::info!( | 287 | tracing::info!( |
| 290 | relay = %url, | 288 | relay = %url, |
| @@ -478,6 +476,19 @@ impl RelayConnection { | |||
| 478 | true | 476 | true |
| 479 | } | 477 | } |
| 480 | 478 | ||
| 479 | /// Mark this relay as not supporting NIP-77 negentropy | ||
| 480 | /// | ||
| 481 | /// Called when we detect negentropy isn't working for this relay: | ||
| 482 | /// - NOTICE message contains negentropy-related error | ||
| 483 | /// - negentropy_sync_diff() fails | ||
| 484 | /// - Negentropy retry returns zero events | ||
| 485 | /// | ||
| 486 | /// Future batches will skip negentropy and use REQ+EOSE directly. | ||
| 487 | pub fn mark_negentropy_unsupported(&self) { | ||
| 488 | self.nip77_supported | ||
| 489 | .store(2, std::sync::atomic::Ordering::Relaxed); | ||
| 490 | } | ||
| 491 | |||
| 481 | /// Perform a negentropy sync diff (dry run) to identify missing events | 492 | /// Perform a negentropy sync diff (dry run) to identify missing events |
| 482 | /// | 493 | /// |
| 483 | /// This method performs NIP-77 negentropy reconciliation without downloading events. | 494 | /// This method performs NIP-77 negentropy reconciliation without downloading events. |
| @@ -564,9 +575,7 @@ impl RelayConnection { | |||
| 564 | Ok(reconciliation) | 575 | Ok(reconciliation) |
| 565 | } | 576 | } |
| 566 | Err(e) => { | 577 | Err(e) => { |
| 567 | // Mark relay as not supporting NIP-77 | 578 | self.mark_negentropy_unsupported(); |
| 568 | self.nip77_supported | ||
| 569 | .store(2, std::sync::atomic::Ordering::Relaxed); | ||
| 570 | 579 | ||
| 571 | // Log warning only once per relay to avoid spam | 580 | // Log warning only once per relay to avoid spam |
| 572 | if !self | 581 | if !self |