mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
nil as the later ranges
This commit is contained in:
parent
27d9dc796a
commit
a63160d4c9
1 changed files with 15 additions and 1 deletions
|
|
@ -444,7 +444,21 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
|
||||||
)
|
)
|
||||||
|
|
||||||
processRange := func(rangePrefix []byte) error {
|
processRange := func(rangePrefix []byte) error {
|
||||||
it := db.NewIterator(slices.Concat(keyPrefix, rangePrefix), keyStart)
|
// Skip ranges that are entirely before keyStart
|
||||||
|
if len(keyStart) > 0 && len(rangePrefix) > 0 && rangePrefix[0] < keyStart[0] {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
prefix = slices.Concat(keyPrefix, rangePrefix)
|
||||||
|
start = []byte(nil)
|
||||||
|
)
|
||||||
|
// Only apply keyStart to the range that contains it
|
||||||
|
if len(keyStart) > 0 && len(rangePrefix) > 0 && rangePrefix[0] == keyStart[0] {
|
||||||
|
start = keyStart[1:] // skip the first byte, as it's in rangePrefix
|
||||||
|
}
|
||||||
|
|
||||||
|
it := db.NewIterator(prefix, start)
|
||||||
defer it.Release()
|
defer it.Release()
|
||||||
|
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue