Order super committe slots list by bitmap order (#3913)

pull/3928/head
Rongjian Lan 3 years ago committed by GitHub
parent c1f62404a3
commit 0bed4945f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      consensus/quorum/one-node-staked-vote.go
  2. 4
      consensus/votepower/roster.go

@ -268,7 +268,9 @@ func (v *stakedVoteWeight) MarshalJSON() ([]byte, error) {
i, externalCount := 0, 0 i, externalCount := 0, 0
totalRaw := numeric.ZeroDec() totalRaw := numeric.ZeroDec()
for identity, voter := range v.roster.Voters { for _, slot := range v.roster.OrderedSlots {
identity := slot
voter := v.roster.Voters[slot]
member := u{ member := u{
voter.IsHarmonyNode, voter.IsHarmonyNode,
common2.MustAddressToBech32(voter.EarningAccount), common2.MustAddressToBech32(voter.EarningAccount),

@ -104,6 +104,7 @@ type Roster struct {
Voters map[bls.SerializedPublicKey]*AccommodateHarmonyVote Voters map[bls.SerializedPublicKey]*AccommodateHarmonyVote
topLevelRegistry topLevelRegistry
ShardID uint32 ShardID uint32
OrderedSlots []bls.SerializedPublicKey
} }
func (r Roster) String() string { func (r Roster) String() string {
@ -245,6 +246,9 @@ func Compute(subComm *shard.Committee, epoch *big.Int) (*Roster, error) {
roster.OurVotingPowerTotalPercentage = ourPercentage roster.OurVotingPowerTotalPercentage = ourPercentage
roster.TheirVotingPowerTotalPercentage = theirPercentage roster.TheirVotingPowerTotalPercentage = theirPercentage
for _, slot := range subComm.Slots {
roster.OrderedSlots = append(roster.OrderedSlots, slot.BLSPublicKey)
}
return roster, nil return roster, nil
} }

Loading…
Cancel
Save