mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package core
|
|
|
|
import (
|
|
"github.com/tendermint/tendermint/config"
|
|
dbm "github.com/tendermint/tendermint/db"
|
|
sm "github.com/tendermint/tendermint/state"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func Status() ([]byte, string, []byte, uint, int64) {
|
|
db := dbm.NewMemDB()
|
|
genesisState := sm.MakeGenesisStateFromFile(db, config.App().GetString("GenesisFile"))
|
|
genesisHash := genesisState.Hash()
|
|
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 genesisHash, config.App().GetString("Network"), latestBlockHash, latestHeight, latestBlockTime
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
func NetInfo() (int, bool, string) {
|
|
o, i, _ := p2pSwitch.NumPeers()
|
|
numPeers := o + i
|
|
listening := p2pSwitch.IsListening()
|
|
network := config.App().GetString("Network")
|
|
return numPeers, listening, network
|
|
}
|