Skip to content

Commit

Permalink
chore: use app router in OnTimeoutPacket handler (#7164)
Browse files Browse the repository at this point in the history
  • Loading branch information
chatton authored Aug 14, 2024
1 parent f5ab15b commit 6327b58
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modules/core/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ func (k *Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTime
}

// Retrieve callbacks from router
cbs, ok := k.PortKeeper.Route(msg.Packet.SourcePort)
cbs, ok := k.PortKeeper.AppRouter.PacketRoute(msg.Packet.SourcePort)
if !ok {
ctx.Logger().Error("timeout on close failed", "port-id", msg.Packet.SourcePort, "error", errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", msg.Packet.SourcePort))
return nil, errorsmod.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", msg.Packet.SourcePort)
Expand Down Expand Up @@ -593,10 +593,12 @@ func (k *Keeper) TimeoutOnClose(goCtx context.Context, msg *channeltypes.MsgTime
//
// NOTE: MsgTimeout and MsgTimeoutOnClose use the same "OnTimeoutPacket"
// application logic callback.
err = cbs.OnTimeoutPacket(ctx, channelVersion, msg.Packet, relayer)
if err != nil {
ctx.Logger().Error("timeout on close failed", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "timeout on close callback failed"))
return nil, errorsmod.Wrap(err, "timeout on close callback failed")
for _, cb := range cbs {
err = cb.OnTimeoutPacket(ctx, channelVersion, msg.Packet, relayer)
if err != nil {
ctx.Logger().Error("timeout on close failed", "port-id", msg.Packet.SourcePort, "channel-id", msg.Packet.SourceChannel, "error", errorsmod.Wrap(err, "timeout on close callback failed"))
return nil, errorsmod.Wrap(err, "timeout on close callback failed")
}
}

defer telemetry.ReportTimeoutPacket(msg.Packet, "channel-closed")
Expand Down

0 comments on commit 6327b58

Please sign in to comment.