[viewchange] check quorum by mask

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3448/head
Leo Chen 4 years ago
parent 2b5ca833f9
commit 1e4b55a7cc
  1. 3
      consensus/quorum/one-node-staked-vote.go
  2. 2
      consensus/view_change.go

@ -146,6 +146,9 @@ func (v *stakedVoteWeight) IsQuorumAchieved(p Phase) bool {
// IsQuorumAchivedByMask ..
func (v *stakedVoteWeight) IsQuorumAchievedByMask(mask *bls_cosi.Mask) bool {
threshold := v.QuorumThreshold()
if mask == nil {
return false
}
currentTotalPower := v.computeTotalPowerByMask(mask)
if currentTotalPower == nil {
return false

@ -351,7 +351,7 @@ func (consensus *Consensus) onViewChange(msg *msg_pb.Message) {
return
}
if consensus.Decider.IsQuorumAchieved(quorum.ViewChange) {
if consensus.Decider.IsQuorumAchievedByMask(consensus.vc.GetViewIDBitmap(recvMsg.ViewID)) {
consensus.getLogger().Info().
Int64("have", consensus.Decider.SignersCount(quorum.ViewChange)).
Int64("need", consensus.Decider.TwoThirdsSignersCount()).

Loading…
Cancel
Save