Browse Source

db: sort keys for memdb iterator

pull/1842/head
Ethan Buchman 7 years ago
parent
commit
135a1a7cd7
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      db/mem_db.go

+ 3
- 0
db/mem_db.go View File

@ -2,6 +2,7 @@ package db
import ( import (
"fmt" "fmt"
"sort"
"strings" "strings"
"sync" "sync"
) )
@ -127,6 +128,8 @@ func (db *MemDB) IteratorPrefix(prefix []byte) Iterator {
it.keys = append(it.keys, key) it.keys = append(it.keys, key)
} }
} }
// and we need to sort them
sort.Strings(it.keys)
return it return it
} }


Loading…
Cancel
Save