[quorum] Expose external slot count for JSON of Decider (#2642)

pull/2646/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent f8d60f3cfa
commit 26241bb9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      consensus/quorum/one-node-staked-vote.go

@ -195,6 +195,7 @@ func (v *stakedVoteWeight) MarshalJSON() ([]byte, error) {
type t struct { type t struct {
Policy string `json:"policy"` Policy string `json:"policy"`
Count int `json:"count"` Count int `json:"count"`
Externals int `json:"external-validator-slot-count"`
Participants []u `json:"committee-members"` Participants []u `json:"committee-members"`
HmyVotingPower string `json:"hmy-voting-power"` HmyVotingPower string `json:"hmy-voting-power"`
StakedVotingPower string `json:"staked-voting-power"` StakedVotingPower string `json:"staked-voting-power"`
@ -202,7 +203,7 @@ func (v *stakedVoteWeight) MarshalJSON() ([]byte, error) {
} }
parts := make([]u, voterCount) parts := make([]u, voterCount)
i := 0 i, externalCount := 0, 0
for identity, voter := range v.roster.Voters { for identity, voter := range v.roster.Voters {
member := u{ member := u{
@ -214,6 +215,7 @@ func (v *stakedVoteWeight) MarshalJSON() ([]byte, error) {
"", "",
} }
if !voter.IsHarmonyNode { if !voter.IsHarmonyNode {
externalCount++
member.EffectiveStake = voter.EffectiveStake.String() member.EffectiveStake = voter.EffectiveStake.String()
} }
parts[i] = member parts[i] = member
@ -223,6 +225,7 @@ func (v *stakedVoteWeight) MarshalJSON() ([]byte, error) {
return json.Marshal(t{ return json.Marshal(t{
v.Policy().String(), v.Policy().String(),
voterCount, voterCount,
externalCount,
parts, parts,
v.roster.OurVotingPowerTotalPercentage.String(), v.roster.OurVotingPowerTotalPercentage.String(),
v.roster.TheirVotingPowerTotalPercentage.String(), v.roster.TheirVotingPowerTotalPercentage.String(),

Loading…
Cancel
Save