[#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:
Alex Vanin 2021-04-01 09:36:29 +03:00 committed by Alex Vanin
parent 88a82820b8
commit 6ff45edbc9
2 changed files with 4 additions and 2 deletions

View file

@ -112,7 +112,8 @@ func List() [][]byte {
func ListByEpoch(epoch int) [][]byte {
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)
}

View file

@ -78,7 +78,8 @@ func GetByID(id []byte) [][]byte {
// via GetByID method.
func ListByEpoch(epoch int) [][]byte {
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