From c44813bcdf95fde2ab7121011b3ca5f02a61ba70 Mon Sep 17 00:00:00 2001 From: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Date: Mon, 8 Jun 2020 14:03:18 +0200 Subject: [PATCH] x/ibc: commit timeout timestamp (#6363) Co-authored-by: Christopher Goes --- x/ibc/04-channel/types/packet.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/ibc/04-channel/types/packet.go b/x/ibc/04-channel/types/packet.go index d271b9856..bb6c37b52 100644 --- a/x/ibc/04-channel/types/packet.go +++ b/x/ibc/04-channel/types/packet.go @@ -9,11 +9,11 @@ import ( host "github.com/cosmos/cosmos-sdk/x/ibc/24-host" ) -// CommitPacket return the hash of commitment bytes -// TODO: no specification for packet commitment currently, -// make it spec compatible once we have it +// CommitPacket returns a packet commitment bytes. The commitment consists of: +// hash(timeout_timestamp + timeout_height + data) from a given packet. func CommitPacket(packet exported.PacketI) []byte { - buf := sdk.Uint64ToBigEndian(packet.GetTimeoutHeight()) + buf := sdk.Uint64ToBigEndian(packet.GetTimeoutTimestamp()) + buf = append(buf, sdk.Uint64ToBigEndian(packet.GetTimeoutHeight())...) buf = append(buf, packet.GetData()...) return tmhash.Sum(buf) }