parent
f88d9ab586
commit
138e0b074f
|
@ -369,16 +369,18 @@ func (sk ScopedKeeper) GetOwners(ctx sdk.Context, name string) (*types.Capabilit
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupModules returns all the module owners for a given capability
|
// LookupModules returns all the module owners for a given capability
|
||||||
// as a string array, the capability is also returned along with a boolean success flag
|
// as a string array and the capability itself.
|
||||||
func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *types.Capability, bool) {
|
// The method returns an errors if either the capability or the owners cannot be
|
||||||
|
// retreived from the memstore.
|
||||||
|
func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *types.Capability, error) {
|
||||||
cap, ok := sk.GetCapability(ctx, name)
|
cap, ok := sk.GetCapability(ctx, name)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, false
|
return nil, nil, sdkerrors.Wrap(types.ErrCapabilityNotFound, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
capOwners, ok := sk.GetOwners(ctx, name)
|
capOwners, ok := sk.GetOwners(ctx, name)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil, false
|
return nil, nil, sdkerrors.Wrap(types.ErrCapabilityOwnersNotFound, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
mods := make([]string, len(capOwners.Owners))
|
mods := make([]string, len(capOwners.Owners))
|
||||||
|
@ -386,7 +388,7 @@ func (sk ScopedKeeper) LookupModules(ctx sdk.Context, name string) ([]string, *t
|
||||||
mods[i] = co.Module
|
mods[i] = co.Module
|
||||||
}
|
}
|
||||||
|
|
||||||
return mods, cap, true
|
return mods, cap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sk ScopedKeeper) addOwner(ctx sdk.Context, cap *types.Capability, name string) error {
|
func (sk ScopedKeeper) addOwner(ctx sdk.Context, cap *types.Capability, name string) error {
|
||||||
|
|
|
@ -177,12 +177,12 @@ func (suite *KeeperTestSuite) TestGetOwners() {
|
||||||
// Ensure all scoped keepers can get owners
|
// Ensure all scoped keepers can get owners
|
||||||
for _, sk := range sks {
|
for _, sk := range sks {
|
||||||
owners, ok := sk.GetOwners(suite.ctx, "transfer")
|
owners, ok := sk.GetOwners(suite.ctx, "transfer")
|
||||||
mods, cap, mok := sk.LookupModules(suite.ctx, "transfer")
|
mods, cap, err := sk.LookupModules(suite.ctx, "transfer")
|
||||||
|
|
||||||
suite.Require().True(ok, "could not retrieve owners")
|
suite.Require().True(ok, "could not retrieve owners")
|
||||||
suite.Require().NotNil(owners, "owners is nil")
|
suite.Require().NotNil(owners, "owners is nil")
|
||||||
|
|
||||||
suite.Require().True(mok, "could not retrieve modules")
|
suite.Require().NoError(err, "could not retrieve modules")
|
||||||
suite.Require().NotNil(cap, "capability is nil")
|
suite.Require().NotNil(cap, "capability is nil")
|
||||||
suite.Require().NotNil(mods, "modules is nil")
|
suite.Require().NotNil(mods, "modules is nil")
|
||||||
|
|
||||||
|
@ -205,12 +205,12 @@ func (suite *KeeperTestSuite) TestGetOwners() {
|
||||||
// Ensure all scoped keepers can get owners
|
// Ensure all scoped keepers can get owners
|
||||||
for _, sk := range sks {
|
for _, sk := range sks {
|
||||||
owners, ok := sk.GetOwners(suite.ctx, "transfer")
|
owners, ok := sk.GetOwners(suite.ctx, "transfer")
|
||||||
mods, cap, mok := sk.LookupModules(suite.ctx, "transfer")
|
mods, cap, err := sk.LookupModules(suite.ctx, "transfer")
|
||||||
|
|
||||||
suite.Require().True(ok, "could not retrieve owners")
|
suite.Require().True(ok, "could not retrieve owners")
|
||||||
suite.Require().NotNil(owners, "owners is nil")
|
suite.Require().NotNil(owners, "owners is nil")
|
||||||
|
|
||||||
suite.Require().True(mok, "could not retrieve modules")
|
suite.Require().NoError(err, "could not retrieve modules")
|
||||||
suite.Require().NotNil(cap, "capability is nil")
|
suite.Require().NotNil(cap, "capability is nil")
|
||||||
suite.Require().NotNil(mods, "modules is nil")
|
suite.Require().NotNil(mods, "modules is nil")
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,6 @@ var (
|
||||||
ErrCapabilityTaken = sdkerrors.Register(ModuleName, 2, "capability name already taken")
|
ErrCapabilityTaken = sdkerrors.Register(ModuleName, 2, "capability name already taken")
|
||||||
ErrOwnerClaimed = sdkerrors.Register(ModuleName, 3, "given owner already claimed capability")
|
ErrOwnerClaimed = sdkerrors.Register(ModuleName, 3, "given owner already claimed capability")
|
||||||
ErrCapabilityNotOwned = sdkerrors.Register(ModuleName, 4, "capability not owned by module")
|
ErrCapabilityNotOwned = sdkerrors.Register(ModuleName, 4, "capability not owned by module")
|
||||||
|
ErrCapabilityNotFound = sdkerrors.Register(ModuleName, 5, "capability not found")
|
||||||
|
ErrCapabilityOwnersNotFound = sdkerrors.Register(ModuleName, 6, "owners not found for capability")
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package keeper
|
package keeper
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"github.com/cosmos/cosmos-sdk/x/capability"
|
"github.com/cosmos/cosmos-sdk/x/capability"
|
||||||
|
@ -74,7 +76,7 @@ func (k Keeper) ChanOpenInit(
|
||||||
k.SetNextSequenceSend(ctx, portID, channelID, 1)
|
k.SetNextSequenceSend(ctx, portID, channelID, 1)
|
||||||
k.SetNextSequenceRecv(ctx, portID, channelID, 1)
|
k.SetNextSequenceRecv(ctx, portID, channelID, 1)
|
||||||
|
|
||||||
k.Logger(ctx).Info("channel (port-id: %s, channel-id: %s) state updated: NONE -> INIT", portID, channelID)
|
k.Logger(ctx).Info(fmt.Sprintf("channel (port-id: %s, channel-id: %s) state updated: NONE -> INIT", portID, channelID))
|
||||||
return capKey, nil
|
return capKey, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +157,7 @@ func (k Keeper) ChanOpenTry(
|
||||||
k.SetNextSequenceSend(ctx, portID, channelID, 1)
|
k.SetNextSequenceSend(ctx, portID, channelID, 1)
|
||||||
k.SetNextSequenceRecv(ctx, portID, channelID, 1)
|
k.SetNextSequenceRecv(ctx, portID, channelID, 1)
|
||||||
|
|
||||||
k.Logger(ctx).Info("channel (port-id: %s, channel-id: %s) state updated: NONE -> TRYOPEN", portID, channelID)
|
k.Logger(ctx).Info(fmt.Sprintf("channel (port-id: %s, channel-id: %s) state updated: NONE -> TRYOPEN", portID, channelID))
|
||||||
return capKey, nil
|
return capKey, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +225,7 @@ func (k Keeper) ChanOpenAck(
|
||||||
channel.Version = counterpartyVersion
|
channel.Version = counterpartyVersion
|
||||||
k.SetChannel(ctx, portID, channelID, channel)
|
k.SetChannel(ctx, portID, channelID, channel)
|
||||||
|
|
||||||
k.Logger(ctx).Info("channel (port-id: %s, channel-id: %s) state updated: INIT -> OPEN", portID, channelID)
|
k.Logger(ctx).Info(fmt.Sprintf("channel (port-id: %s, channel-id: %s) state updated: INIT -> OPEN", portID, channelID))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +290,7 @@ func (k Keeper) ChanOpenConfirm(
|
||||||
channel.State = ibctypes.OPEN
|
channel.State = ibctypes.OPEN
|
||||||
k.SetChannel(ctx, portID, channelID, channel)
|
k.SetChannel(ctx, portID, channelID, channel)
|
||||||
|
|
||||||
k.Logger(ctx).Info("channel (port-id: %s, channel-id: %s) state updated: TRYOPEN -> OPEN", portID, channelID)
|
k.Logger(ctx).Info(fmt.Sprintf("channel (port-id: %s, channel-id: %s) state updated: TRYOPEN -> OPEN", portID, channelID))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +332,7 @@ func (k Keeper) ChanCloseInit(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
k.Logger(ctx).Info("channel (port-id: %s, channel-id: %s) state updated: %s -> CLOSED", portID, channelID, channel.State)
|
k.Logger(ctx).Info(fmt.Sprintf("channel (port-id: %s, channel-id: %s) state updated: %s -> CLOSED", portID, channelID, channel.State))
|
||||||
|
|
||||||
channel.State = ibctypes.CLOSED
|
channel.State = ibctypes.CLOSED
|
||||||
k.SetChannel(ctx, portID, channelID, channel)
|
k.SetChannel(ctx, portID, channelID, channel)
|
||||||
|
@ -393,7 +395,7 @@ func (k Keeper) ChanCloseConfirm(
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
k.Logger(ctx).Info("channel (port-id: %s, channel-id: %s) state updated: %s -> CLOSED", portID, channelID, channel.State)
|
k.Logger(ctx).Info(fmt.Sprintf("channel (port-id: %s, channel-id: %s) state updated: %s -> CLOSED", portID, channelID, channel.State))
|
||||||
|
|
||||||
channel.State = ibctypes.CLOSED
|
channel.State = ibctypes.CLOSED
|
||||||
k.SetChannel(ctx, portID, channelID, channel)
|
k.SetChannel(ctx, portID, channelID, channel)
|
||||||
|
|
|
@ -251,13 +251,13 @@ func (k Keeper) GetAllChannels(ctx sdk.Context) (channels []types.IdentifiedChan
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupModuleByChannel will return the IBCModule along with the capability associated with a given channel defined by its portID and channelID
|
// LookupModuleByChannel will return the IBCModule along with the capability associated with a given channel defined by its portID and channelID
|
||||||
func (k Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capability.Capability, bool) {
|
func (k Keeper) LookupModuleByChannel(ctx sdk.Context, portID, channelID string) (string, *capability.Capability, error) {
|
||||||
modules, cap, ok := k.scopedKeeper.LookupModules(ctx, ibctypes.ChannelCapabilityPath(portID, channelID))
|
modules, cap, err := k.scopedKeeper.LookupModules(ctx, ibctypes.ChannelCapabilityPath(portID, channelID))
|
||||||
if !ok {
|
if err != nil {
|
||||||
return "", nil, false
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ibctypes.GetModuleOwner(modules), cap, true
|
return ibctypes.GetModuleOwner(modules), cap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// common functionality for IteratePacketCommitment and IteratePacketAcknowledgemen
|
// common functionality for IteratePacketCommitment and IteratePacketAcknowledgemen
|
||||||
|
|
|
@ -70,12 +70,12 @@ func (k Keeper) Authenticate(ctx sdk.Context, key *capability.Capability, portID
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupModuleByPort will return the IBCModule along with the capability associated with a given portID
|
// LookupModuleByPort will return the IBCModule along with the capability associated with a given portID
|
||||||
func (k Keeper) LookupModuleByPort(ctx sdk.Context, portID string) (string, *capability.Capability, bool) {
|
func (k Keeper) LookupModuleByPort(ctx sdk.Context, portID string) (string, *capability.Capability, error) {
|
||||||
modules, cap, ok := k.scopedKeeper.LookupModules(ctx, ibctypes.PortPath(portID))
|
modules, cap, err := k.scopedKeeper.LookupModules(ctx, ibctypes.PortPath(portID))
|
||||||
if !ok {
|
if err != nil {
|
||||||
return "", nil, false
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ibctypes.GetModuleOwner(modules), cap, true
|
return ibctypes.GetModuleOwner(modules), cap, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,11 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
// IBC channel msgs
|
// IBC channel msgs
|
||||||
case channel.MsgChannelOpenInit:
|
case channel.MsgChannelOpenInit:
|
||||||
// Lookup module by port capability
|
// Lookup module by port capability
|
||||||
module, portCap, ok := k.PortKeeper.LookupModuleByPort(ctx, msg.PortID)
|
module, portCap, err := k.PortKeeper.LookupModuleByPort(ctx, msg.PortID)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(port.ErrInvalidPort, "could not retrieve module from portID")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
|
|
||||||
res, cap, err := channel.HandleMsgChannelOpenInit(ctx, k.ChannelKeeper, portCap, msg)
|
res, cap, err := channel.HandleMsgChannelOpenInit(ctx, k.ChannelKeeper, portCap, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -61,9 +62,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgChannelOpenTry:
|
case channel.MsgChannelOpenTry:
|
||||||
// Lookup module by port capability
|
// Lookup module by port capability
|
||||||
module, portCap, ok := k.PortKeeper.LookupModuleByPort(ctx, msg.PortID)
|
module, portCap, err := k.PortKeeper.LookupModuleByPort(ctx, msg.PortID)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(port.ErrInvalidPort, "could not retrieve module from portID")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
res, cap, err := channel.HandleMsgChannelOpenTry(ctx, k.ChannelKeeper, portCap, msg)
|
res, cap, err := channel.HandleMsgChannelOpenTry(ctx, k.ChannelKeeper, portCap, msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -83,16 +84,17 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgChannelOpenAck:
|
case channel.MsgChannelOpenAck:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
cbs, ok := k.Router.GetRoute(module)
|
cbs, ok := k.Router.GetRoute(module)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
||||||
}
|
}
|
||||||
err := cbs.OnChanOpenAck(ctx, msg.PortID, msg.ChannelID, msg.CounterpartyVersion)
|
|
||||||
|
err = cbs.OnChanOpenAck(ctx, msg.PortID, msg.ChannelID, msg.CounterpartyVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -100,9 +102,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgChannelOpenConfirm:
|
case channel.MsgChannelOpenConfirm:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
cbs, ok := k.Router.GetRoute(module)
|
cbs, ok := k.Router.GetRoute(module)
|
||||||
|
@ -110,7 +112,7 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := cbs.OnChanOpenConfirm(ctx, msg.PortID, msg.ChannelID)
|
err = cbs.OnChanOpenConfirm(ctx, msg.PortID, msg.ChannelID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -118,9 +120,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgChannelCloseInit:
|
case channel.MsgChannelCloseInit:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
cbs, ok := k.Router.GetRoute(module)
|
cbs, ok := k.Router.GetRoute(module)
|
||||||
|
@ -128,7 +130,7 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := cbs.OnChanCloseInit(ctx, msg.PortID, msg.ChannelID)
|
err = cbs.OnChanCloseInit(ctx, msg.PortID, msg.ChannelID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -136,9 +138,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgChannelCloseConfirm:
|
case channel.MsgChannelCloseConfirm:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.PortID, msg.ChannelID)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
cbs, ok := k.Router.GetRoute(module)
|
cbs, ok := k.Router.GetRoute(module)
|
||||||
|
@ -146,7 +148,7 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := cbs.OnChanCloseConfirm(ctx, msg.PortID, msg.ChannelID)
|
err = cbs.OnChanCloseConfirm(ctx, msg.PortID, msg.ChannelID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -155,9 +157,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
// IBC packet msgs get routed to the appropriate module callback
|
// IBC packet msgs get routed to the appropriate module callback
|
||||||
case channel.MsgPacket:
|
case channel.MsgPacket:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, _, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.DestinationPort, msg.Packet.DestinationChannel)
|
module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.DestinationPort, msg.Packet.DestinationChannel)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
|
@ -169,9 +171,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgAcknowledgement:
|
case channel.MsgAcknowledgement:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, _, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
module, _, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
|
@ -183,9 +185,9 @@ func NewHandler(k Keeper) sdk.Handler {
|
||||||
|
|
||||||
case channel.MsgTimeout:
|
case channel.MsgTimeout:
|
||||||
// Lookup module by channel capability
|
// Lookup module by channel capability
|
||||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
module, cap, err := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
return nil, sdkerrors.Wrap(err, "could not retrieve module from port-id")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve callbacks from router
|
// Retrieve callbacks from router
|
||||||
|
|
Loading…
Reference in New Issue