From 735343430dec74a340f5c9a18822537e18165caa Mon Sep 17 00:00:00 2001 From: weimumu <934657014@qq.com> Date: Fri, 28 Dec 2018 15:43:55 +0800 Subject: fix string array unpack bug in accounts/abi (#18364) --- accounts/abi/unpack.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'accounts/abi/unpack.go') 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 -- cgit v1.2.3