mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-29 13:41:47 +00:00
b030c331b0
It's a bug since Prefix is shared between all iterator items and appending is not enough. If prefix has enough capacity, then new slice won't be created and the previous item's prefix will be changed. This commit fixes the following test failure caused by moving from bytes.Clone to slice.Copy: ``` --- FAIL: TestComlileAndInvokeFunction/test_Storage.Find (0.02s) --- FAIL: TestComlileAndInvokeFunction/test_Storage.Find/keys_only (0.01s) contract_test.go:866: Error Trace: /home/anna/Documents/GitProjects/nspcc-dev/neo-go/cli/smartcontract/contract_test.go:866 Error: Not equal: expected: []stackitem.Item{(*stackitem.ByteArray)(0xc000a1cdf8), (*stackitem.ByteArray)(0xc000a1ce10)} actual : []stackitem.Item{(*stackitem.ByteArray)(0xc000a1cdb0), (*stackitem.ByteArray)(0xc000a1cdc8)} Diff: --- Expected +++ Actual @@ -2,3 +2,3 @@ (*stackitem.ByteArray)((len=8) { - 00000000 66 69 6e 64 6b 65 79 31 |findkey1| + 00000000 66 69 6e 64 6b 65 79 32 |findkey2| }), Test: TestComlileAndInvokeFunction/test_Storage.Find/keys_only --- FAIL: TestComlileAndInvokeFunction/test_Storage.Find/both (0.01s) contract_test.go:881: Error Trace: /home/anna/Documents/GitProjects/nspcc-dev/neo-go/cli/smartcontract/contract_test.go:881 Error: Not equal: expected: []stackitem.Item{(*stackitem.ByteArray)(0xc000515920), (*stackitem.ByteArray)(0xc000515938)} actual : []stackitem.Item{(*stackitem.ByteArray)(0xc000515848), (*stackitem.ByteArray)(0xc000515860)} Diff: --- Expected +++ Actual @@ -2,3 +2,3 @@ (*stackitem.ByteArray)((len=8) { - 00000000 66 69 6e 64 6b 65 79 31 |findkey1| + 00000000 66 69 6e 64 6b 65 79 32 |findkey2| }), Test: TestComlileAndInvokeFunction/test_Storage.Find/both ``` Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru> |
||
---|---|---|
.. | ||
basic.go | ||
bench_test.go | ||
find.go | ||
interops_test.go | ||
storage_test.go |