badger: fix logic for checking if an event id exists.
This commit is contained in:
@@ -19,6 +19,7 @@ func (b *BadgerBackend) DeleteEvent(ctx context.Context, evt *nostr.Event) error
|
|||||||
// query event by id to get its idx
|
// query event by id to get its idx
|
||||||
id, _ := hex.DecodeString(evt.ID)
|
id, _ := hex.DecodeString(evt.ID)
|
||||||
prefix := make([]byte, 1+32)
|
prefix := make([]byte, 1+32)
|
||||||
|
prefix[0] = indexIdPrefix
|
||||||
copy(prefix[1:], id)
|
copy(prefix[1:], id)
|
||||||
opts := badger.DefaultIteratorOptions
|
opts := badger.DefaultIteratorOptions
|
||||||
opts.PrefetchValues = false
|
opts.PrefetchValues = false
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ func (b *BadgerBackend) SaveEvent(ctx context.Context, evt *nostr.Event) error {
|
|||||||
// query event by id to ensure we don't save duplicates
|
// query event by id to ensure we don't save duplicates
|
||||||
id, _ := hex.DecodeString(evt.ID)
|
id, _ := hex.DecodeString(evt.ID)
|
||||||
prefix := make([]byte, 1+32)
|
prefix := make([]byte, 1+32)
|
||||||
|
prefix[0] = indexIdPrefix
|
||||||
copy(prefix[1:], id)
|
copy(prefix[1:], id)
|
||||||
opts := badger.DefaultIteratorOptions
|
opts := badger.DefaultIteratorOptions
|
||||||
opts.PrefetchValues = false
|
opts.PrefetchValues = false
|
||||||
|
|||||||
Reference in New Issue
Block a user