[#65] Do not use integer as a search prefix
Even though it is allowed to do so, it can produce invalid search results if key is less than 10 bytes. More at https://github.com/nspcc-dev/neo-go/issues/1873 Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
88a82820b8
commit
6ff45edbc9
2 changed files with 4 additions and 2 deletions
|
@ -112,7 +112,8 @@ func List() [][]byte {
|
||||||
|
|
||||||
func ListByEpoch(epoch int) [][]byte {
|
func ListByEpoch(epoch int) [][]byte {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
it := storage.Find(ctx, epoch, storage.KeysOnly)
|
var buf interface{} = epoch
|
||||||
|
it := storage.Find(ctx, buf.([]byte), storage.KeysOnly)
|
||||||
|
|
||||||
return list(it)
|
return list(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,8 @@ func GetByID(id []byte) [][]byte {
|
||||||
// via GetByID method.
|
// via GetByID method.
|
||||||
func ListByEpoch(epoch int) [][]byte {
|
func ListByEpoch(epoch int) [][]byte {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
it := storage.Find(ctx, epoch, storage.KeysOnly)
|
var buf interface{} = epoch
|
||||||
|
it := storage.Find(ctx, buf.([]byte), storage.KeysOnly)
|
||||||
|
|
||||||
var result [][]byte
|
var result [][]byte
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue