From 0356f8ae9e65867ac723108b69f4d445185c0847 Mon Sep 17 00:00:00 2001 From: izyak Date: Wed, 17 Jan 2024 16:39:30 +0545 Subject: [PATCH] feat: implement get timestamp for tendermint --- .../go/common/tendermint/consensus_state_extended.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/go/common/tendermint/consensus_state_extended.go b/libraries/go/common/tendermint/consensus_state_extended.go index 5964e73f9..e306736cb 100644 --- a/libraries/go/common/tendermint/consensus_state_extended.go +++ b/libraries/go/common/tendermint/consensus_state_extended.go @@ -1,5 +1,12 @@ package tendermint +import "time" + func (m *ConsensusState) ValidateBasic() error { return nil } -func (m *ConsensusState) ClientType() string { return "icon" } -func (m *ConsensusState) GetTimestamp() uint64 { return 0 } +func (m *ConsensusState) ClientType() string { return "icAon" } + +// this returns the timestamp in nanoseconds +func (m *ConsensusState) GetTimestamp() uint64 { + secondsToNano := time.Second * time.Duration(m.Timestamp.Seconds) // convert seconds to nanoseconds + return uint64(secondsToNano + time.Duration(m.Timestamp.Nanos)) +}