Skip to content

Commit

Permalink
chore: comment hop slicing for clarity (#6702)
Browse files Browse the repository at this point in the history
Co-authored-by: Carlos Rodriguez <[email protected]>
  • Loading branch information
2 people authored and bznein committed Jun 26, 2024
1 parent 816c263 commit 9e4634e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/apps/transfer/keeper/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
func (k Keeper) forwardPacket(ctx sdk.Context, data types.FungibleTokenPacketDataV2, packet channeltypes.Packet, receivedCoins sdk.Coins) error {
var nextForwardingPath types.Forwarding
if len(data.Forwarding.Hops) > 1 {
// remove the first hop since it has been completed (this chain has received the packet)
nextForwardingPath = types.NewForwarding(false, data.Forwarding.Hops[1:]...)
}

Expand Down
1 change: 1 addition & 0 deletions modules/apps/transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (k Keeper) unwindHops(ctx sdk.Context, msg *types.MsgTransfer) (*types.MsgT
return nil, errorsmod.Wrap(types.ErrInvalidForwarding, "cannot unwind a native token")
}
var unwindHops []types.Hop
// remove the first hop in denom as it is the current port/channel on this chain
for _, trace := range token.Denom.Trace[1:] {
unwindHops = append(unwindHops, types.Hop{PortId: trace.PortId, ChannelId: trace.ChannelId}) //nolint: gosimple
}
Expand Down

0 comments on commit 9e4634e

Please sign in to comment.