mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 03:58:06 +00:00
Merge pull request #1888 from nspcc-dev/fix-storage-find-key-clashes
core: fix key clashes in Storage.Find
This commit is contained in:
commit
6c48257d1a
1 changed files with 4 additions and 1 deletions
|
@ -49,7 +49,10 @@ func storageFind(ic *interop.Context) error {
|
|||
|
||||
filteredMap := stackitem.NewMap()
|
||||
for k, v := range siMap {
|
||||
filteredMap.Add(stackitem.NewByteArray(append(prefix, []byte(k)...)), stackitem.NewByteArray(v))
|
||||
key := append(prefix, []byte(k)...)
|
||||
keycopy := make([]byte, len(key))
|
||||
copy(keycopy, key)
|
||||
filteredMap.Add(stackitem.NewByteArray(keycopy), stackitem.NewByteArray(v))
|
||||
}
|
||||
sort.Slice(filteredMap.Value().([]stackitem.MapElement), func(i, j int) bool {
|
||||
return bytes.Compare(filteredMap.Value().([]stackitem.MapElement)[i].Key.Value().([]byte),
|
||||
|
|
Loading…
Reference in a new issue