Skip to content

Commit

Permalink
(chore) replace reflect.DeepEqual with slices.Equal (#6697)
Browse files Browse the repository at this point in the history
* Replace reflect.DeepEqual with slices.Equal

* Nit formatting
  • Loading branch information
bznein authored Jun 25, 2024
1 parent 5345776 commit 74088ba
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 74088ba

Please sign in to comment.