accounts/abi: simplify Arguments.Unpack (#24277)
Since len(nonIndexedArgs) is definitely 0 in this context, the code can be simplified.
This commit is contained in:
parent
f9ce40bb84
commit
f39f068161
@ -81,13 +81,7 @@ func (arguments Arguments) Unpack(data []byte) ([]interface{}, error) {
|
|||||||
if len(arguments) != 0 {
|
if len(arguments) != 0 {
|
||||||
return nil, fmt.Errorf("abi: attempting to unmarshall an empty string while arguments are expected")
|
return nil, fmt.Errorf("abi: attempting to unmarshall an empty string while arguments are expected")
|
||||||
}
|
}
|
||||||
// Nothing to unmarshal, return default variables
|
return make([]interface{}, 0), nil
|
||||||
nonIndexedArgs := arguments.NonIndexed()
|
|
||||||
defaultVars := make([]interface{}, len(nonIndexedArgs))
|
|
||||||
for index, arg := range nonIndexedArgs {
|
|
||||||
defaultVars[index] = reflect.New(arg.Type.GetType())
|
|
||||||
}
|
|
||||||
return defaultVars, nil
|
|
||||||
}
|
}
|
||||||
return arguments.UnpackValues(data)
|
return arguments.UnpackValues(data)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user