Skip to content

Commit

Permalink
channel: fix connection hop selection on close
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopernas committed Mar 8, 2024
1 parent 959fcfb commit b27f0cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/core/04-channel/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,11 @@ func (k Keeper) ChanCloseConfirm(
return sdkerrors.Wrapf(types.ErrInvalidChannelState, "channel is already %s", sState)
}

connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[len(channel.ConnectionHops)-1])
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found {
return sdkerrors.Wrap(
connectiontypes.ErrConnectionNotFound,
channel.ConnectionHops[len(channel.ConnectionHops)-1],
channel.ConnectionHops[0],
)
}

Expand Down Expand Up @@ -802,11 +802,11 @@ func (k Keeper) ChanCloseFrozen(
return sdkerrors.Wrap(types.ErrInvalidChannelState, "channel is already CLOSED")
}

connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[len(channel.ConnectionHops)-1])
connectionEnd, found := k.connectionKeeper.GetConnection(ctx, channel.ConnectionHops[0])
if !found {
return sdkerrors.Wrap(
connectiontypes.ErrConnectionNotFound,
channel.ConnectionHops[len(channel.ConnectionHops)-1],
channel.ConnectionHops[0],
)
}

Expand Down

0 comments on commit b27f0cd

Please sign in to comment.