From 816c26325bf54ead035f699ec2da961d754a0fae Mon Sep 17 00:00:00 2001 From: Nikolas De Giorgis Date: Tue, 25 Jun 2024 16:43:45 +0100 Subject: [PATCH] (chore) replace reflect.DeepEqual with slices.Equal (#6697) * Replace reflect.DeepEqual with slices.Equal * Nit formatting --- modules/apps/transfer/types/transfer_authorization.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/apps/transfer/types/transfer_authorization.go b/modules/apps/transfer/types/transfer_authorization.go index a7605bf306f..4dfe20eafb2 100644 --- a/modules/apps/transfer/types/transfer_authorization.go +++ b/modules/apps/transfer/types/transfer_authorization.go @@ -3,7 +3,6 @@ package types import ( "context" "math/big" - "reflect" "slices" "strings" @@ -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 } }