aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/method.go
diff options
context:
space:
mode:
authorDmitry Shulyak <yashulyak@gmail.com>2017-12-20 22:09:23 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-20 22:09:23 +0800
commitda58afcea0525fab2d3f45f58e7e243a15407ab9 (patch)
treeaa93996ead74ae3356b90214ee706f5a00cdb888 /accounts/abi/method.go
parentce823c9f84a3ab46003d1167ee54ab59b01092d6 (diff)
downloaddexon-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar
dexon-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.gz
dexon-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.bz2
dexon-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.lz
dexon-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.xz
dexon-da58afcea0525fab2d3f45f58e7e243a15407ab9.tar.zst
dexon-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.go9
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() {