x/ibc: implement 09-localhost per specification (#5769)
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
This commit is contained in:
@@ -142,6 +142,7 @@ type ClientType byte
|
||||
// available client types
|
||||
const (
|
||||
Tendermint ClientType = iota + 1 // 1
|
||||
Localhost
|
||||
)
|
||||
|
||||
// string representation of the client types
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||
ibctmtypes "github.com/cosmos/cosmos-sdk/x/ibc/07-tendermint/types"
|
||||
localhost "github.com/cosmos/cosmos-sdk/x/ibc/09-localhost"
|
||||
)
|
||||
|
||||
// HandleMsgCreateClient defines the sdk.Handler for MsgCreateClient
|
||||
@@ -27,6 +28,8 @@ func HandleMsgCreateClient(ctx sdk.Context, k Keeper, msg exported.MsgCreateClie
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case exported.Localhost:
|
||||
clientState = localhost.NewClientState(ctx.MultiStore().GetKVStore(k.GetStoreKey()))
|
||||
default:
|
||||
return nil, sdkerrors.Wrap(ErrInvalidClientType, msg.GetClientType())
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
||||
return ctx.Logger().With("module", fmt.Sprintf("x/%s/%s", ibctypes.ModuleName, types.SubModuleName))
|
||||
}
|
||||
|
||||
func (k Keeper) GetStoreKey() sdk.StoreKey {
|
||||
return k.storeKey
|
||||
}
|
||||
|
||||
// GetClientState gets a particular client from the store
|
||||
func (k Keeper) GetClientState(ctx sdk.Context, clientID string) (exported.ClientState, bool) {
|
||||
store := k.clientStore(ctx, clientID)
|
||||
|
||||
Reference in New Issue
Block a user