diff options
author | weimumu <934657014@qq.com> | 2018-12-28 15:43:55 +0800 |
---|---|---|
committer | Guillaume Ballet <gballet@gmail.com> | 2018-12-28 15:43:55 +0800 |
commit | 735343430dec74a340f5c9a18822537e18165caa (patch) | |
tree | b8c889f5212b9598ffef5022958feb6afcddf4c3 /accounts/abi/unpack.go | |
parent | 9e9fc87e70accf2b81be8772ab2ab0c914e95666 (diff) | |
download | dexon-735343430dec74a340f5c9a18822537e18165caa.tar dexon-735343430dec74a340f5c9a18822537e18165caa.tar.gz dexon-735343430dec74a340f5c9a18822537e18165caa.tar.bz2 dexon-735343430dec74a340f5c9a18822537e18165caa.tar.lz dexon-735343430dec74a340f5c9a18822537e18165caa.tar.xz dexon-735343430dec74a340f5c9a18822537e18165caa.tar.zst dexon-735343430dec74a340f5c9a18822537e18165caa.zip |
fix string array unpack bug in accounts/abi (#18364)
Diffstat (limited to 'accounts/abi/unpack.go')
-rw-r--r-- | accounts/abi/unpack.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/accounts/abi/unpack.go b/accounts/abi/unpack.go index c3bbbb251..04716f7a2 100644 --- a/accounts/abi/unpack.go +++ b/accounts/abi/unpack.go @@ -195,8 +195,15 @@ func toGoType(index int, t Type, output []byte) (interface{}, error) { switch t.T { case SliceTy: + if (*t.Elem).T == StringTy { + return forEachUnpack(t, output[begin:], 0, end) + } return forEachUnpack(t, output, begin, end) case ArrayTy: + if (*t.Elem).T == StringTy { + offset := int64(binary.BigEndian.Uint64(returnOutput[len(returnOutput)-8:])) + return forEachUnpack(t, output[offset:], 0, t.Size) + } return forEachUnpack(t, output, index, t.Size) case StringTy: // variable arrays are written at the end of the return bytes return string(output[begin : begin+end]), nil |