Skip to content

Commit

Permalink
map on refundPacketToken
Browse files Browse the repository at this point in the history
  • Loading branch information
codehans committed Jun 3, 2023
1 parent eff29c8 commit 12fcdfc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/apps/transfer/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ func (k Keeper) refundPacketToken(ctx sdk.Context, packet channeltypes.Packet, d
if types.SenderChainIsSource(packet.GetSourcePort(), packet.GetSourceChannel(), data.Denom) {
// unescrow tokens back to sender
escrowAddress := types.GetEscrowAddress(packet.GetSourcePort(), packet.GetSourceChannel())

prefix := k.GetSlashPrefix(ctx)
if prefix != "" && strings.HasPrefix(token.Denom, prefix+":") {
token.Denom = strings.ReplaceAll(token.Denom, ":", "/")
}

if err := k.bankKeeper.SendCoins(ctx, escrowAddress, sender, sdk.NewCoins(token)); err != nil {
// NOTE: this error is only expected to occur given an unexpected bug or a malicious
// counterparty module. The bug may occur in bank or any part of the code that allows
Expand Down

0 comments on commit 12fcdfc

Please sign in to comment.