accounts/abi: simplify Arguments.Unpack (#24277)

Since len(nonIndexedArgs) is definitely 0 in this context, the code can be simplified.
release/1.10
zhiqiangxu 3 years ago committed by GitHub
parent f9ce40bb84
commit f39f068161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      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)
}

Loading…
Cancel
Save