[rpc][validator] Expose lifetime signing counters again (#2524)

* [apr] More log in various steps of actual compute for apr

* [rpc][validator] Expose total signing counters again, move block reward w/counters to lifetime JSON key
pull/2530/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent 706338db46
commit bf9bbc2a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      staking/types/validator.go

@ -73,9 +73,9 @@ type ValidatorSnapshotReader interface {
type counters struct {
// The number of blocks the validator
// should've signed when in active mode (selected in committee)
NumBlocksToSign *big.Int `json:"num-blocks-to-sign",rlp:"nil"`
NumBlocksToSign *big.Int `json:"to-sign",rlp:"nil"`
// The number of blocks the validator actually signed
NumBlocksSigned *big.Int `json:"num-blocks-signed",rlp:"nil"`
NumBlocksSigned *big.Int `json:"signed",rlp:"nil"`
}
// ValidatorWrapper contains validator,
@ -138,6 +138,11 @@ type ValidatorRPCEnchanced struct {
EPoSStatus string `json:"epos-status"`
}
type accumulatedOverLifetime struct {
BlockReward *big.Int `json:"reward-accumulated"`
Signing counters `json:"blocks"`
}
func (w ValidatorWrapper) String() string {
s, _ := json.Marshal(w)
return string(s)
@ -147,14 +152,14 @@ func (w ValidatorWrapper) String() string {
func (w ValidatorWrapper) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Validator
Address string `json:"address"`
Delegations Delegations `json:"delegations"`
BlockReward *big.Int `json:"block-reward-accumulated"`
Address string `json:"address"`
Delegations Delegations `json:"delegations"`
Lifetime accumulatedOverLifetime `json:"lifetime"`
}{
w.Validator,
common2.MustAddressToBech32(w.Address),
w.Delegations,
w.BlockReward,
accumulatedOverLifetime{w.BlockReward, w.Counters},
})
}

Loading…
Cancel
Save