consensus/clique: fix struct tags for status API (#20316)

Also unexport the status struct.
pull/20331/head
Felix Lange 5 years ago committed by GitHub
parent 3f4a875bf6
commit c5c5e0dbe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      consensus/clique/api.go

@ -120,9 +120,9 @@ func (api *API) Discard(address common.Address) {
delete(api.clique.proposals, address) delete(api.clique.proposals, address)
} }
type Status struct { type status struct {
InturnPercent float64 `json:"inturnPercent"` InturnPercent float64 `json:"inturnPercent"`
SigningStatus map[common.Address]int `json:"sealerActivity""` SigningStatus map[common.Address]int `json:"sealerActivity"`
NumBlocks uint64 `json:"numBlocks"` NumBlocks uint64 `json:"numBlocks"`
} }
@ -130,7 +130,7 @@ type Status struct {
// - the number of active signers, // - the number of active signers,
// - the number of signers, // - the number of signers,
// - the percentage of in-turn blocks // - the percentage of in-turn blocks
func (api *API) Status() (*Status, error) { func (api *API) Status() (*status, error) {
var ( var (
numBlocks = uint64(64) numBlocks = uint64(64)
header = api.chain.CurrentHeader() header = api.chain.CurrentHeader()
@ -169,7 +169,7 @@ func (api *API) Status() (*Status, error) {
} }
signStatus[sealer]++ signStatus[sealer]++
} }
return &Status{ return &status{
InturnPercent: float64((100 * optimals)) / float64(numBlocks), InturnPercent: float64((100 * optimals)) / float64(numBlocks),
SigningStatus: signStatus, SigningStatus: signStatus,
NumBlocks: numBlocks, NumBlocks: numBlocks,

Loading…
Cancel
Save