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

Loading…
Cancel
Save