Skip to content

Commit

Permalink
refactor: using slices.Contains to simplify the code
Browse files Browse the repository at this point in the history
Signed-off-by: dashangcun <907225865@qq.com>
  • Loading branch information
dashangcun committed Jan 9, 2025
1 parent de04d53 commit 87356d9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions relayer/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package relayer
import (
"context"
"fmt"
"slices"
"strings"

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
Expand Down Expand Up @@ -152,12 +153,7 @@ func (p *Path) ValidateChannelFilterRule() error {

// InChannelList returns true if the channelID argument is in the ChannelFilter's ChannelList or false otherwise.
func (cf *ChannelFilter) InChannelList(channelID string) bool {
for _, channel := range cf.ChannelList {
if channel == channelID {
return true
}
}
return false
return slices.Contains(cf.ChannelList, channelID)
}

// End returns the proper end given a chainID.
Expand Down

0 comments on commit 87356d9

Please sign in to comment.