Skip to content

Commit

Permalink
accounts/abi: simplify Arguments.Unpack (ethereum#24277)
Browse files Browse the repository at this point in the history
Since len(nonIndexedArgs) is definitely 0 in this context, the code can be simplified.
  • Loading branch information
zhiqiangxu authored and jagdeep sidhu committed Jan 28, 2022
1 parent 07565d1 commit 8cc3032
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions accounts/abi/argument.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 8cc3032

Please sign in to comment.