Skip to content

Commit

Permalink
extra validation that timeoutTimeInFuture.Before(blockTime) return error
Browse files Browse the repository at this point in the history
  • Loading branch information
RustNinja committed Mar 19, 2024
1 parent f4ff771 commit a4a7c29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom/ibc-transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ func (k msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*typ
blockTime := goCtx.BlockTime()

timeoutTimeInFuture := time.Unix(0, int64(msg.TimeoutTimestamp))
if timeoutTimeInFuture.Before(blockTime) {
return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. timeout timestamp is in the past")
}

difference := timeoutTimeInFuture.Sub(blockTime).Nanoseconds()

if difference < channelFee.MinTimeoutTimestamp {
return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer")
return nil, fmt.Errorf("incorrect timeout timestamp found during ibc transfer. too soon")
}
}
coin := findCoinByDenom(channelFee.AllowedTokens, msg.Token.Denom)
Expand Down

0 comments on commit a4a7c29

Please sign in to comment.