You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
929 B

  1. package core
  2. import (
  3. data "github.com/tendermint/go-wire/data"
  4. ctypes "github.com/tendermint/tendermint/rpc/core/types"
  5. "github.com/tendermint/tendermint/types"
  6. )
  7. func Status() (*ctypes.ResultStatus, error) {
  8. latestHeight := blockStore.Height()
  9. var (
  10. latestBlockMeta *types.BlockMeta
  11. latestBlockHash data.Bytes
  12. latestAppHash data.Bytes
  13. latestBlockTime int64
  14. )
  15. if latestHeight != 0 {
  16. latestBlockMeta = blockStore.LoadBlockMeta(latestHeight)
  17. latestBlockHash = latestBlockMeta.BlockID.Hash
  18. latestAppHash = latestBlockMeta.Header.AppHash
  19. latestBlockTime = latestBlockMeta.Header.Time.UnixNano()
  20. }
  21. return &ctypes.ResultStatus{
  22. NodeInfo: p2pSwitch.NodeInfo(),
  23. PubKey: pubKey,
  24. LatestBlockHash: latestBlockHash,
  25. LatestAppHash: latestAppHash,
  26. LatestBlockHeight: latestHeight,
  27. LatestBlockTime: latestBlockTime,
  28. Syncing: consensusReactor.FastSync()}, nil
  29. }