mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-06 07:28:23 +00:00
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.
This commit is contained in:
@@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user