diff options
author | Dmitry Shulyak <yashulyak@gmail.com> | 2017-12-20 22:09:23 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-12-20 22:09:23 +0800 |
commit | da58afcea0525fab2d3f45f58e7e243a15407ab9 (patch) | |
tree | aa93996ead74ae3356b90214ee706f5a00cdb888 /accounts/abi/method.go | |
parent | ce823c9f84a3ab46003d1167ee54ab59b01092d6 (diff) | |
download | go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.gz go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.bz2 go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.lz go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.xz go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.zst go-tangerine-da58afcea0525fab2d3f45f58e7e243a15407ab9.zip |
accounts/abi: update array length after parsing array (#15618)
Fixes #15617
Diffstat (limited to 'accounts/abi/method.go')
-rw-r--r-- | accounts/abi/method.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/accounts/abi/method.go b/accounts/abi/method.go index d8838e9ed..6b9aa011e 100644 --- a/accounts/abi/method.go +++ b/accounts/abi/method.go @@ -95,14 +95,15 @@ func (method Method) tupleUnpack(v interface{}, output []byte) error { j := 0 for i := 0; i < len(method.Outputs); i++ { toUnpack := method.Outputs[i] - if toUnpack.Type.T == ArrayTy { - // need to move this up because they read sequentially - j += toUnpack.Type.Size - } marshalledValue, err := toGoType((i+j)*32, toUnpack.Type, output) if err != nil { return err } + if toUnpack.Type.T == ArrayTy { + // combined index ('i' + 'j') need to be adjusted only by size of array, thus + // we need to decrement 'j' because 'i' was incremented + j += toUnpack.Type.Size - 1 + } reflectValue := reflect.ValueOf(marshalledValue) switch value.Kind() { |