Skip to content

Commit

Permalink
add check empty version in OnChanOpenInit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanhNhann committed Sep 23, 2024
1 parent 00b172f commit 99d0620
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/oracle/module/module_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/onomyprotocol/reserve/x/oracle/keeper"
"github.com/onomyprotocol/reserve/x/oracle/types"
"strconv"
"strings"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -48,6 +49,10 @@ func (im IBCModule) OnChanOpenInit(

bandParams := im.keeper.GetBandParams(ctx)

if strings.TrimSpace(version) == "" {
version = bandParams.IbcVersion
}

if version != bandParams.IbcVersion {
return "", errorsmod.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, bandParams.IbcVersion)
}
Expand Down

0 comments on commit 99d0620

Please sign in to comment.