From 28832bf98afba4bec581f08ab0bb8244c3162624 Mon Sep 17 00:00:00 2001 From: suha jin <89185836+djm07073@users.noreply.github.com> Date: Fri, 21 Jun 2024 18:41:50 +0900 Subject: [PATCH] fix: refactoring --- x/ophost/types/hook/bridge_hook.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/x/ophost/types/hook/bridge_hook.go b/x/ophost/types/hook/bridge_hook.go index fb6bfa02..9c3470a0 100644 --- a/x/ophost/types/hook/bridge_hook.go +++ b/x/ophost/types/hook/bridge_hook.go @@ -42,17 +42,14 @@ func (h BridgeHook) BridgeCreated( if !hasPermChannels { return nil } - var challengers []sdk.AccAddress - for _, challenger := range bridgeConfig.Challengers { - challenger, err := h.ac.StringToBytes(challenger) - if err != nil { - return err - } - challengers = append(challengers, challenger) - } - if len(challengers) != 1 { + + if len(bridgeConfig.Challengers) != 1 { return errors.New("only one challenger is allowed on bridge creation") } + challengers := make([]sdk.AccAddress, 1) + challengerStr, _ := h.ac.StringToBytes(bridgeConfig.Challengers[0]) + challengers[0] = challengerStr + sdkCtx := sdk.UnwrapSDKContext(ctx) for _, permChannel := range metadata.PermChannels { portID, channelID := permChannel.PortID, permChannel.ChannelID