mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 20:21:56 +00:00
rpc: make time human readable. closes #926
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
data "github.com/tendermint/go-wire/data"
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
@@ -56,18 +58,20 @@ import (
|
||||
func Status() (*ctypes.ResultStatus, error) {
|
||||
latestHeight := blockStore.Height()
|
||||
var (
|
||||
latestBlockMeta *types.BlockMeta
|
||||
latestBlockHash data.Bytes
|
||||
latestAppHash data.Bytes
|
||||
latestBlockTime int64
|
||||
latestBlockMeta *types.BlockMeta
|
||||
latestBlockHash data.Bytes
|
||||
latestAppHash data.Bytes
|
||||
latestBlockTimeNano int64
|
||||
)
|
||||
if latestHeight != 0 {
|
||||
latestBlockMeta = blockStore.LoadBlockMeta(latestHeight)
|
||||
latestBlockHash = latestBlockMeta.BlockID.Hash
|
||||
latestAppHash = latestBlockMeta.Header.AppHash
|
||||
latestBlockTime = latestBlockMeta.Header.Time.UnixNano()
|
||||
latestBlockTimeNano = latestBlockMeta.Header.Time.UnixNano()
|
||||
}
|
||||
|
||||
latestBlockTime := time.Unix(0, latestBlockTimeNano)
|
||||
|
||||
return &ctypes.ResultStatus{
|
||||
NodeInfo: p2pSwitch.NodeInfo(),
|
||||
PubKey: pubKey,
|
||||
|
Reference in New Issue
Block a user