Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use app router in OnTimeoutPacket handler #7164

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading