x/ibc: commit timeout timestamp (#6363)

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>
This commit is contained in:
Federico Kunze 2020-06-08 14:03:18 +02:00 committed by GitHub
parent c26bbe6c9c
commit c44813bcdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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)
}