eventstore: skip replacing when it's the exact same id.

This commit is contained in:
fiatjaf
2025-11-30 22:11:49 -03:00
parent a355f27adb
commit fb3b14c69c
3 changed files with 27 additions and 0 deletions

View File

@@ -11,6 +11,14 @@ import (
func (b *BoltBackend) ReplaceEvent(evt nostr.Event) error {
return b.DB.Update(func(txn *bbolt.Tx) error {
rawBucket := txn.Bucket(rawEventStore)
// check if we already have this id
bin := rawBucket.Get(evt.ID[16:24])
if bin != nil {
return nil
}
filter := nostr.Filter{Kinds: []nostr.Kind{evt.Kind}, Authors: []nostr.PubKey{evt.PubKey}}
if evt.Kind.IsAddressable() {
// when addressable, add the "d" tag to the filter