Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) replace reflect.DeepEqual with slices.Equal #6697

Merged
merged 6 commits into from
Jun 25, 2024
Merged
7 changes: 5 additions & 2 deletions modules/apps/transfer/types/transfer_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"context"
"math/big"
"reflect"
"slices"
"strings"

Expand Down Expand Up @@ -189,8 +188,12 @@ func isAllowedForwarding(hops []Hop, allowed []Hops) bool {
return true
}

// We want to ensure that at least one of the Hops in "allowed"
// is equal to "hops".
// Note that we can't use slices.Contains() as that is a generic
// function that requires the type Hop to satisfy the "comparable" constraint.
for _, allowedHops := range allowed {
if reflect.DeepEqual(hops, allowedHops.Hops) {
if slices.Equal(hops, allowedHops.Hops) {
return true
}
}
Expand Down
Loading