mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 20:21:56 +00:00
rpc: add app_hash to /status
This commit is contained in:
30
rpc/core/status.go
Normal file
30
rpc/core/status.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
func Status() (*ctypes.ResultStatus, error) {
|
||||
latestHeight := blockStore.Height()
|
||||
var (
|
||||
latestBlockMeta *types.BlockMeta
|
||||
latestBlockHash []byte
|
||||
latestAppHash []byte
|
||||
latestBlockTime int64
|
||||
)
|
||||
if latestHeight != 0 {
|
||||
latestBlockMeta = blockStore.LoadBlockMeta(latestHeight)
|
||||
latestBlockHash = latestBlockMeta.Hash
|
||||
latestAppHash = latestBlockMeta.Header.AppHash
|
||||
latestBlockTime = latestBlockMeta.Header.Time.UnixNano()
|
||||
}
|
||||
|
||||
return &ctypes.ResultStatus{
|
||||
NodeInfo: p2pSwitch.NodeInfo(),
|
||||
PubKey: privValidator.PubKey,
|
||||
LatestBlockHash: latestBlockHash,
|
||||
LatestAppHash: latestAppHash,
|
||||
LatestBlockHeight: latestHeight,
|
||||
LatestBlockTime: latestBlockTime}, nil
|
||||
}
|
Reference in New Issue
Block a user