// check if there are enough prevotes to justify another prevote given a quorum
check if there are enough prevotes to justify another prevote given a quorum
// check if there are enough prevotes to justify another prevote given a quorum
func (acc *Accountability) checkQuorumPrevotesForPrevote(hvs *common.HeightVoteSet, lockedValue *common.Value, lockedRound int64, prevote *common.Message) bool {
	for round, vs := range hvs.VoteSetMap {
		if vs == nil || !(round < prevote.Round &&
			(int64(round) >= lockedRound || lockedValue.Equal(prevote.Value))) {
			continue
		}
		numberOfAppropriateMessages := uint64(0)
		for _, receivedPrevoteMessage := range vs.ReceivedPrevoteMessages {
			if receivedPrevoteMessage.Value != nil && receivedPrevoteMessage.Value.Equal(prevote.Value) {
				numberOfAppropriateMessages++
			}
		}
		if numberOfAppropriateMessages >= acc.getQuorumThreshold() {
			return true
		}
	}
	return false
}
func ( acc * Accountability ) checkQuorumPrevotesForPrevote ( hvs * common . HeightVoteSet , lockedValue * common . Value , lockedRound int64 , prevote * common . Message ) bool { for round , vs := range hvs . VoteSetMap { if vs == nil || ! ( round < prevote . Round && ( int64 ( round ) >= lockedRound || lockedValue . Equal ( prevote . Value ) ) ) { continue } numberOfAppropriateMessages := uint64 ( 0 ) for _ , receivedPrevoteMessage := range vs . ReceivedPrevoteMessages { if receivedPrevoteMessage . Value != nil && receivedPrevoteMessage . Value . Equal ( prevote . Value ) { numberOfAppropriateMessages ++ } } if numberOfAppropriateMessages >= acc . getQuorumThreshold ( ) { return true } } return false }
check if there are enough prevotes to justify another prevote given a quorum
check if there are enough prevotes to justify another prevote given a quorum
// go over all the votes in each round // if vote set not present or it's not between the lockedRound and the current round, it's not valid according to the consensus algorithm