Browse Source

add validator address to /status

pull/1511/head
Ethan Buchman 7 years ago
parent
commit
47e4d64973
2 changed files with 11 additions and 6 deletions
  1. +10
    -6
      rpc/core/status.go
  2. +1
    -0
      rpc/core/types/responses.go

+ 10
- 6
rpc/core/status.go View File

@ -79,6 +79,11 @@ func Status() (*ctypes.ResultStatus, error) {
latestBlockTime := time.Unix(0, latestBlockTimeNano)
var votingPower int64
if val := validatorAtHeight(latestHeight); val != nil {
votingPower = val.VotingPower
}
result := &ctypes.ResultStatus{
NodeInfo: p2pSwitch.NodeInfo(),
SyncInfo: ctypes.SyncInfo{
@ -88,12 +93,11 @@ func Status() (*ctypes.ResultStatus, error) {
LatestBlockTime: latestBlockTime,
Syncing: consensusReactor.FastSync(),
},
ValidatorInfo: ctypes.ValidatorInfo{PubKey: pubKey},
}
// add ValidatorStatus if node is a validator
if val := validatorAtHeight(latestHeight); val != nil {
result.ValidatorInfo.VotingPower = val.VotingPower
ValidatorInfo: ctypes.ValidatorInfo{
Address: pubKey.Address(),
PubKey: pubKey,
VotingPower: votingPower,
},
}
return result, nil


+ 1
- 0
rpc/core/types/responses.go View File

@ -63,6 +63,7 @@ type SyncInfo struct {
}
type ValidatorInfo struct {
Address cmn.HexBytes `json:"address"`
PubKey crypto.PubKey `json:"pub_key"`
VotingPower int64 `json:"voting_power"`
}


Loading…
Cancel
Save