khatru: store and broadcast kind:5 deletion events.

by insistence of @staab
This commit is contained in:
fiatjaf
2025-10-31 16:36:39 -03:00
parent 32bbff615a
commit b87bc0ede4
5 changed files with 79 additions and 37 deletions

View File

@@ -113,15 +113,17 @@ func (em *expirationManager) checkExpiredEvents(ctx context.Context) {
}
}
func (em *expirationManager) trackEvent(evt nostr.Event) {
if expiresAt := nip40.GetExpiration(evt.Tags); expiresAt != -1 {
em.mu.Lock()
heap.Push(&em.events, expiringEvent{
id: evt.ID,
expiresAt: expiresAt,
})
em.mu.Unlock()
func (em *expirationManager) trackEvent(id nostr.ID, expiration nostr.Timestamp) {
if expiration <= 0 {
return
}
em.mu.Lock()
heap.Push(&em.events, expiringEvent{
id: id,
expiresAt: expiration,
})
em.mu.Unlock()
}
func (em *expirationManager) removeEvent(id nostr.ID) {