lmdb/badger: fix duplicate identification code for tag indexing.
Some checks failed
build cli / make-release (push) Has been cancelled
build cli / build-linux (push) Has been cancelled

This commit is contained in:
fiatjaf
2024-01-05 18:12:39 -03:00
parent 98199d7553
commit d3bafc2ec8
2 changed files with 4 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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
}