upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/nostr/policy/announcement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/nostr/policy/announcement.rs')
-rw-r--r--src/nostr/policy/announcement.rs16
1 files 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 {
225 // Remove the announcement from purgatory 225 // Remove the announcement from purgatory
226 self.ctx.purgatory.remove_announcement(pubkey, identifier); 226 self.ctx.purgatory.remove_announcement(pubkey, identifier);
227 227
228 // Remove any state events waiting for this identifier 228 // Only remove state events if no other owner still has an announcement in purgatory
229 self.ctx.purgatory.remove_state(identifier); 229 // for this identifier. State events are keyed by identifier alone, so blindly removing
230 // them would also discard state events legitimately belonging to a different owner's
231 // repository that happens to share the same identifier string.
232 let other_owners_remain = !self
233 .ctx
234 .purgatory
235 .get_announcements_by_identifier(identifier)
236 .is_empty();
237
238 if !other_owners_remain {
239 self.ctx.purgatory.remove_state(identifier);
240 }
230 241
231 tracing::info!( 242 tracing::info!(
232 identifier = %identifier, 243 identifier = %identifier,
244 other_owners_remain = %other_owners_remain,
233 "Cleared purgatory entry: owner removed our service from announcement" 245 "Cleared purgatory entry: owner removed our service from announcement"
234 ); 246 );
235 } 247 }