Skip to content

Commit ffdf046

Browse files
author
Nikolas De Giorgis
committed
(chore) replace reflect.DeepEqual with slices.Equal (#6697)
* Replace reflect.DeepEqual with slices.Equal * Nit formatting
1 parent 1f01a4e commit ffdf046

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/apps/transfer/types/transfer_authorization.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package types
33
import (
44
"context"
55
"math/big"
6-
"reflect"
76
"slices"
87
"strings"
98

@@ -189,8 +188,12 @@ func isAllowedForwarding(hops []Hop, allowed []Hops) bool {
189188
return true
190189
}
191190

191+
// We want to ensure that at least one of the Hops in "allowed"
192+
// is equal to "hops".
193+
// Note that we can't use slices.Contains() as that is a generic
194+
// function that requires the type Hop to satisfy the "comparable" constraint.
192195
for _, allowedHops := range allowed {
193-
if reflect.DeepEqual(hops, allowedHops.Hops) {
196+
if slices.Equal(hops, allowedHops.Hops) {
194197
return true
195198
}
196199
}

0 commit comments

Comments
 (0)