mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 13:51:21 +00:00
rpc: add app_hash to /status
This commit is contained in:
@ -2,35 +2,10 @@ package core
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
ctypes "github.com/tendermint/tendermint/rpc/core/types"
|
||||||
"github.com/tendermint/tendermint/types"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// TODO Move to status.go or node.go
|
|
||||||
func Status() (*ctypes.ResultStatus, error) {
|
|
||||||
latestHeight := blockStore.Height()
|
|
||||||
var (
|
|
||||||
latestBlockMeta *types.BlockMeta
|
|
||||||
latestBlockHash []byte
|
|
||||||
latestBlockTime int64
|
|
||||||
)
|
|
||||||
if latestHeight != 0 {
|
|
||||||
latestBlockMeta = blockStore.LoadBlockMeta(latestHeight)
|
|
||||||
latestBlockHash = latestBlockMeta.Hash
|
|
||||||
latestBlockTime = latestBlockMeta.Header.Time.UnixNano()
|
|
||||||
}
|
|
||||||
|
|
||||||
return &ctypes.ResultStatus{
|
|
||||||
NodeInfo: p2pSwitch.NodeInfo(),
|
|
||||||
PubKey: privValidator.PubKey,
|
|
||||||
LatestBlockHash: latestBlockHash,
|
|
||||||
LatestBlockHeight: latestHeight,
|
|
||||||
LatestBlockTime: latestBlockTime}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
func NetInfo() (*ctypes.ResultNetInfo, error) {
|
func NetInfo() (*ctypes.ResultNetInfo, error) {
|
||||||
listening := p2pSwitch.IsListening()
|
listening := p2pSwitch.IsListening()
|
||||||
listeners := []string{}
|
listeners := []string{}
|
||||||
|
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
|
||||||
|
}
|
@ -21,6 +21,7 @@ type ResultStatus struct {
|
|||||||
NodeInfo *p2p.NodeInfo `json:"node_info"`
|
NodeInfo *p2p.NodeInfo `json:"node_info"`
|
||||||
PubKey crypto.PubKey `json:"pub_key"`
|
PubKey crypto.PubKey `json:"pub_key"`
|
||||||
LatestBlockHash []byte `json:"latest_block_hash"`
|
LatestBlockHash []byte `json:"latest_block_hash"`
|
||||||
|
LatestAppHash []byte `json:"latest_app_hash"`
|
||||||
LatestBlockHeight int `json:"latest_block_height"`
|
LatestBlockHeight int `json:"latest_block_height"`
|
||||||
LatestBlockTime int64 `json:"latest_block_time"` // nano
|
LatestBlockTime int64 `json:"latest_block_time"` // nano
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user