From 2f365fc3b209f6d377d59a6ab8a6891b0350fee6 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 18 Feb 2026 09:58:41 +0000 Subject: fix: preserve state events when another owner's announcement remains in purgatory remove_purgatory_announcement() was unconditionally wiping all state events for an identifier when one owner's announcement was evicted. State events are keyed by identifier alone, so this incorrectly discarded state events belonging to a different owner's repository sharing the same identifier string. Now only removes state events if no other owner's announcement remains in purgatory for that identifier. --- src/nostr/policy/announcement.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/nostr/policy/announcement.rs b/src/nostr/policy/announcement.rs index 9b92aeb..b366f0b 100644 --- a/src/nostr/policy/announcement.rs +++ b/src/nostr/policy/announcement.rs @@ -225,11 +225,23 @@ impl AnnouncementPolicy { // Remove the announcement from purgatory self.ctx.purgatory.remove_announcement(pubkey, identifier); - // Remove any state events waiting for this identifier - self.ctx.purgatory.remove_state(identifier); + // Only remove state events if no other owner still has an announcement in purgatory + // for this identifier. State events are keyed by identifier alone, so blindly removing + // them would also discard state events legitimately belonging to a different owner's + // repository that happens to share the same identifier string. + let other_owners_remain = !self + .ctx + .purgatory + .get_announcements_by_identifier(identifier) + .is_empty(); + + if !other_owners_remain { + self.ctx.purgatory.remove_state(identifier); + } tracing::info!( identifier = %identifier, + other_owners_remain = %other_owners_remain, "Cleared purgatory entry: owner removed our service from announcement" ); } -- cgit v1.2.3