ethdb/memorydb: add errMemorydbClosed check

Co-authored-by: Martin HS <martin@swende.se>
This commit is contained in:
Felföldi Zsolt 2025-01-17 13:32:22 +01:00 committed by GitHub
parent 9aadac61be
commit 7261d0bea3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,6 +126,9 @@ func (db *Database) Delete(key []byte) error {
func (db *Database) DeleteRange(start, end []byte) error {
db.lock.Lock()
defer db.lock.Unlock()
if db.db == nil {
return errMemorydbClosed
}
for key := range db.db {
if key >= string(start) && key < string(end) {