From a4a7c29b8616d50d09f3afa0eab300621f029071 Mon Sep 17 00:00:00 2001 From: rustdev Date: Tue, 19 Mar 2024 23:48:55 +0000 Subject: [PATCH] extra validation that timeoutTimeInFuture.Before(blockTime) return error --- custom/ibc-transfer/keeper/msg_server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom/ibc-transfer/keeper/msg_server.go b/custom/ibc-transfer/keeper/msg_server.go index f84dff35..a6d27234 100644 --- a/custom/ibc-transfer/keeper/msg_server.go +++ b/custom/ibc-transfer/keeper/msg_server.go @@ -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)