From eb5ad381c19405829bed2962412015011cd3fe50 Mon Sep 17 00:00:00 2001 From: chengwenxi Date: Fri, 25 Oct 2019 17:09:42 +0800 Subject: [PATCH] fix channel and packet check --- x/ibc/04-channel/keeper/handshake.go | 2 +- x/ibc/04-channel/keeper/packet.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x/ibc/04-channel/keeper/handshake.go b/x/ibc/04-channel/keeper/handshake.go index 19292249a264..5e49ea6b87a0 100644 --- a/x/ibc/04-channel/keeper/handshake.go +++ b/x/ibc/04-channel/keeper/handshake.go @@ -182,7 +182,7 @@ func (k Keeper) ChanOpenAck( // counterparty of the counterparty channel end (i.e self) counterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.NewChannel( - types.INIT, channel.Ordering, counterparty, + types.OPENTRY, channel.Ordering, counterparty, channel.CounterpartyHops(), channel.Version, ) diff --git a/x/ibc/04-channel/keeper/packet.go b/x/ibc/04-channel/keeper/packet.go index 82b871d31284..3858c57f3ed7 100644 --- a/x/ibc/04-channel/keeper/packet.go +++ b/x/ibc/04-channel/keeper/packet.go @@ -195,9 +195,9 @@ func (k Keeper) RecvPacket( acknowledgement []byte, ) (exported.PacketI, error) { - channel, found := k.GetChannel(ctx, packet.SourcePort(), packet.SourceChannel()) + channel, found := k.GetChannel(ctx, packet.DestPort(), packet.DestChannel()) if !found { - return nil, types.ErrChannelNotFound(k.codespace, packet.SourceChannel()) + return nil, types.ErrChannelNotFound(k.codespace, packet.DestChannel()) } if channel.State != types.OPEN { @@ -207,7 +207,7 @@ func (k Keeper) RecvPacket( ) } - _, found = k.GetChannelCapability(ctx, packet.SourcePort(), packet.SourceChannel()) + _, found = k.GetChannelCapability(ctx, packet.DestPort(), packet.DestChannel()) if !found { return nil, types.ErrChannelCapabilityNotFound(k.codespace) }