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.

26 lines
951 B

  1. package core
  2. import (
  3. "github.com/tendermint/go-wire"
  4. cm "github.com/tendermint/tendermint/consensus"
  5. ctypes "github.com/tendermint/tendermint/rpc/core/types"
  6. "github.com/tendermint/tendermint/types"
  7. )
  8. func Validators() (*ctypes.ResultValidators, error) {
  9. blockHeight, validators := consensusState.GetValidators()
  10. return &ctypes.ResultValidators{blockHeight, validators}, nil
  11. }
  12. func DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) {
  13. roundState := consensusState.GetRoundState()
  14. peerRoundStates := []string{}
  15. for _, peer := range p2pSwitch.Peers().List() {
  16. // TODO: clean this up?
  17. peerState := peer.Data.Get(types.PeerStateKey).(*cm.PeerState)
  18. peerRoundState := peerState.GetRoundState()
  19. peerRoundStateStr := peer.Key + ":" + string(wire.JSONBytes(peerRoundState))
  20. peerRoundStates = append(peerRoundStates, peerRoundStateStr)
  21. }
  22. return &ctypes.ResultDumpConsensusState{roundState.String(), peerRoundStates}, nil
  23. }