mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 23:18:24 +00:00
fix: Enable sync relay discovery in archive_all mode
The bug: SelfSubscriber filtered announcements with lists_our_relay() check, preventing archive_all mode from discovering relays in announcements that don't list our relay domain. The insight: SelfSubscriber only receives events that ALREADY passed write policy validation (archive_all, archive_whitelist, blacklist, etc.) via admit_event() before being saved to the database. The event flow: External relay → process_event_static() → write_policy.admit_event() → (validation happens here) → save to DB → notify_event() → SelfSubscriber receives via WebSocket So the lists_our_relay() check was redundant double-validation that broke archive_all mode by filtering events that had already been accepted by the write policy. The fix: Simply remove the lists_our_relay() filtering. Events reaching SelfSubscriber are pre-validated and should all be processed for relay discovery according to the configured archive policy. Changes: - Removed lists_our_relay() check from process_notification() (4 lines) - Removed unused lists_our_relay() helper function (9 lines) - Added comment explaining events are pre-validated (3 lines) - Total: 13 lines removed, 3 lines added Fixes #194d
This commit is contained in:
@@ -148,12 +148,11 @@ impl SelfSubscriber {
|
||||
) -> LoopControl {
|
||||
match notification {
|
||||
Ok(RelayPoolNotification::Event { event, .. }) => {
|
||||
// Only process 30617 events that list our relay
|
||||
// Process 30617 events for relay discovery
|
||||
// Note: Events reaching here have already passed write policy validation
|
||||
// (archive_all, archive_whitelist, blacklist, etc.) so no additional
|
||||
// filtering is needed.
|
||||
if event.kind == Kind::GitRepoAnnouncement {
|
||||
if !self.lists_our_relay(&event) {
|
||||
return LoopControl::Continue;
|
||||
}
|
||||
|
||||
// Extract repo ID and relays
|
||||
if let Some(repo_id) = Self::extract_repo_id(&event) {
|
||||
let relays = Self::extract_relay_urls(&event);
|
||||
@@ -251,15 +250,6 @@ impl SelfSubscriber {
|
||||
None
|
||||
}
|
||||
|
||||
/// Check if announcement lists our relay
|
||||
///
|
||||
/// Returns true if any extracted relay URL contains our domain
|
||||
fn lists_our_relay(&self, event: &Event) -> bool {
|
||||
Self::extract_relay_urls(event)
|
||||
.iter()
|
||||
.any(|url| url.contains(&self.relay_domain) || url == &self.own_relay_url)
|
||||
}
|
||||
|
||||
/// Main run loop
|
||||
///
|
||||
/// Connects to own relay, subscribes to relevant event kinds,
|
||||
|
||||
Reference in New Issue
Block a user