diff --git a/badger/helpers.go b/badger/helpers.go index 8ab5a9e..dc70ddb 100644 --- a/badger/helpers.go +++ b/badger/helpers.go @@ -92,7 +92,8 @@ func getIndexKeysForEvent(evt *nostr.Event, idx []byte) [][]byte { // not indexable continue } - if i > 0 && evt.Tags[i-1][1] == tag[1] { + firstIndex := slices.IndexFunc(evt.Tags, func(t nostr.Tag) bool { return len(t) >= 2 && t[1] == tag[1] }) + if firstIndex != i { // duplicate continue } diff --git a/lmdb/helpers.go b/lmdb/helpers.go index fbe179f..fef9dbb 100644 --- a/lmdb/helpers.go +++ b/lmdb/helpers.go @@ -85,7 +85,8 @@ func (b *LMDBBackend) getIndexKeysForEvent(evt *nostr.Event) []key { // not indexable continue } - if i > 0 && evt.Tags[i-1][1] == tag[1] { + firstIndex := slices.IndexFunc(evt.Tags, func(t nostr.Tag) bool { return len(t) >= 2 && t[1] == tag[1] }) + if firstIndex != i { // duplicate continue }