Skip to content

Commit

Permalink
go tendermint badger: don't scan whole keyspace
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Feb 11, 2020
1 parent f4fc2c3 commit 2f0adf0
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions go/consensus/tendermint/db/badger/badger.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,22 +338,22 @@ func (it *badgerDBIterator) Next() {
panic("Next with invalid iterator")
}

for {
it.iter.Next()
if !it.iter.Valid() {
break
}
it.iter.Next()
if !it.iter.Valid() {
it.Close()
return
}

item := it.iter.Item()
k := fromDBKeyNoCopy(item.KeyCopy(nil))
if dbm.IsKeyInDomain(k, it.start, it.end) {
it.current.item = item
it.current.key = k
it.current.value = nil // Copy done on access.
return
}
item := it.iter.Item()
k := fromDBKeyNoCopy(item.KeyCopy(nil))
if dbm.IsKeyInDomain(k, it.start, it.end) {
it.current.item = item
it.current.key = k
it.current.value = nil // Copy done on access.
return
}

// We've left the requested range.
it.Close()
}

Expand Down

0 comments on commit 2f0adf0

Please sign in to comment.