accounts/abi: only loop once

This commit is contained in:
Marius van der Wijden 2025-03-14 11:03:21 +01:00
parent 97e2d5aeb7
commit f829928fb1

View file

@ -182,17 +182,12 @@ func (arguments Arguments) copyTuple(v interface{}, marshalledValues []interface
// without supplying a struct to unpack into. Instead, this method returns a list containing the // without supplying a struct to unpack into. Instead, this method returns a list containing the
// values. An atomic argument will be a list with one element. // values. An atomic argument will be a list with one element.
func (arguments Arguments) UnpackValues(data []byte) ([]interface{}, error) { func (arguments Arguments) UnpackValues(data []byte) ([]interface{}, error) {
size := 0 var (
for _, arg := range arguments { retval = make([]interface{}, 0)
if arg.Indexed { virtualArgs = 0
continue index = 0
} )
size++
}
retval := make([]interface{}, 0, size)
virtualArgs := 0
index := 0
for _, arg := range arguments { for _, arg := range arguments {
if arg.Indexed { if arg.Indexed {
continue continue