mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Update memorydb.go
This commit is contained in:
parent
2e5cd21edf
commit
2d239bdf12
1 changed files with 12 additions and 2 deletions
|
|
@ -287,11 +287,21 @@ func (b *batch) Write() error {
|
|||
delete(b.db.db, entry.key)
|
||||
} else {
|
||||
// Range deletion (inclusive of start, exclusive of end)
|
||||
var (
|
||||
rangeFrom string
|
||||
rangeTo string
|
||||
)
|
||||
if entry.rangeFrom != nil {
|
||||
rangeFrom = string(entry.rangeFrom)
|
||||
}
|
||||
if entry.rangeTo != nil {
|
||||
rangeTo = string(entry.rangeTo)
|
||||
}
|
||||
for key := range b.db.db {
|
||||
if entry.rangeFrom != nil && key < string(entry.rangeFrom) {
|
||||
if entry.rangeFrom != nil && key < rangeFrom {
|
||||
continue
|
||||
}
|
||||
if entry.rangeTo != nil && key >= string(entry.rangeTo) {
|
||||
if entry.rangeTo != nil && key >= rangeTo {
|
||||
continue
|
||||
}
|
||||
delete(b.db.db, key)
|
||||
|
|
|
|||
Loading…
Reference in a new issue