From f39f068161e10b06dd7e5d764c0083eec7eec6ad Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Tue, 25 Jan 2022 00:19:43 +0800 Subject: [PATCH] accounts/abi: simplify Arguments.Unpack (#24277) Since len(nonIndexedArgs) is definitely 0 in this context, the code can be simplified. --- accounts/abi/argument.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/accounts/abi/argument.go b/accounts/abi/argument.go index 261b4d1b86..e6c117fe5f 100644 --- a/accounts/abi/argument.go +++ b/accounts/abi/argument.go @@ -81,13 +81,7 @@ func (arguments Arguments) Unpack(data []byte) ([]interface{}, error) { if len(arguments) != 0 { return nil, fmt.Errorf("abi: attempting to unmarshall an empty string while arguments are expected") } - // Nothing to unmarshal, return default variables - nonIndexedArgs := arguments.NonIndexed() - defaultVars := make([]interface{}, len(nonIndexedArgs)) - for index, arg := range nonIndexedArgs { - defaultVars[index] = reflect.New(arg.Type.GetType()) - } - return defaultVars, nil + return make([]interface{}, 0), nil } return arguments.UnpackValues(data) }