prevent saving duplicates in badger and lmdb.

This commit is contained in:
fiatjaf
2023-11-06 12:19:02 -03:00
parent da19fdcc10
commit 02e05e2935
3 changed files with 28 additions and 1 deletions

View File

@@ -25,7 +25,6 @@ func (b *BadgerBackend) DeleteEvent(ctx context.Context, evt *nostr.Event) error
it := txn.NewIterator(opts)
it.Seek(prefix)
if it.ValidForPrefix(prefix) {
// the key is the last 32 bytes
idx = append(idx, it.Item().Key()[1+32:]...)
}
it.Close()