eventstore: remove useless sanity checking since event fields are already typed.
This commit is contained in:
@@ -3,7 +3,6 @@ package lmdb
|
||||
import (
|
||||
"fmt"
|
||||
"iter"
|
||||
"math"
|
||||
|
||||
"fiatjaf.com/nostr"
|
||||
"fiatjaf.com/nostr/eventstore/internal"
|
||||
@@ -11,11 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func (b *LMDBBackend) ReplaceEvent(evt nostr.Event) error {
|
||||
// sanity checking
|
||||
if evt.CreatedAt > math.MaxUint32 || evt.Kind > math.MaxUint16 {
|
||||
return fmt.Errorf("event with values out of expected boundaries %d/%d", evt.CreatedAt, evt.Kind)
|
||||
}
|
||||
|
||||
return b.lmdbEnv.Update(func(txn *lmdb.Txn) error {
|
||||
filter := nostr.Filter{Limit: 1, Kinds: []nostr.Kind{evt.Kind}, Authors: []nostr.PubKey{evt.PubKey}}
|
||||
if evt.Kind.IsAddressable() {
|
||||
|
||||
@@ -2,7 +2,6 @@ package lmdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"fiatjaf.com/nostr"
|
||||
"fiatjaf.com/nostr/eventstore"
|
||||
@@ -11,11 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func (b *LMDBBackend) SaveEvent(evt nostr.Event) error {
|
||||
// sanity checking
|
||||
if evt.CreatedAt > math.MaxUint32 || evt.Kind > math.MaxUint16 {
|
||||
return fmt.Errorf("event with values out of expected boundaries %d/%d", evt.CreatedAt, evt.Kind)
|
||||
}
|
||||
|
||||
return b.lmdbEnv.Update(func(txn *lmdb.Txn) error {
|
||||
if b.EnableHLLCacheFor != nil {
|
||||
// modify hyperloglog caches relative to this
|
||||
|
||||
@@ -3,7 +3,6 @@ package mmm
|
||||
import (
|
||||
"fmt"
|
||||
"iter"
|
||||
"math"
|
||||
"runtime"
|
||||
|
||||
"fiatjaf.com/nostr"
|
||||
@@ -12,11 +11,6 @@ import (
|
||||
)
|
||||
|
||||
func (il *IndexingLayer) ReplaceEvent(evt nostr.Event) error {
|
||||
// sanity checking
|
||||
if evt.CreatedAt > math.MaxUint32 || evt.Kind > math.MaxUint16 {
|
||||
return fmt.Errorf("event with values out of expected boundaries")
|
||||
}
|
||||
|
||||
il.mmmm.writeMutex.Lock()
|
||||
defer il.mmmm.writeMutex.Unlock()
|
||||
|
||||
|
||||
@@ -53,11 +53,6 @@ func (b *MultiMmapManager) storeOn(
|
||||
iltxns []*lmdb.Txn,
|
||||
evt nostr.Event,
|
||||
) (stored bool, err error) {
|
||||
// sanity checking
|
||||
if evt.CreatedAt > maxuint32 || evt.Kind > maxuint16 {
|
||||
return false, fmt.Errorf("event with values out of expected boundaries")
|
||||
}
|
||||
|
||||
// check if we already have this id
|
||||
val, err := mmmtxn.Get(b.indexId, evt.ID[0:8])
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user