// IsValid checks if the height vote set is valid and contains valid data
IsValid checks if the height vote set is valid and contains valid data
// IsValid checks if the height vote set is valid and contains valid data
func (hvs *HeightVoteSet) IsValid(ID string) bool {
	for round, vs := range hvs.VoteSetMap {
		for _, mess := range vs.SentPrevoteMessages {
			if mess.Type != Prevote || mess.Round != round || mess.SenderID != ID {
				return false
			}
		}
		for _, mess := range vs.ReceivedPrevoteMessages {
			if mess.Type != Prevote || mess.Round != round {
				return false
			}
		}
		for _, mess := range vs.SentPrecommitMessages {
			if mess.Type != Precommit || mess.Round != round || mess.SenderID != ID {
				return false
			}
		}
		for _, mess := range vs.ReceivedPrecommitMessages {
			if mess.Type != Precommit || mess.Round != round {
				return false
			}
		}
	}
	return true
}
func ( hvs * HeightVoteSet ) IsValid ( ID string ) bool { for round , vs := range hvs . VoteSetMap { for _ , mess := range vs . SentPrevoteMessages { if mess . Type != Prevote || mess . Round != round || mess . SenderID != ID { return false } } for _ , mess := range vs . ReceivedPrevoteMessages { if mess . Type != Prevote || mess . Round != round { return false } } for _ , mess := range vs . SentPrecommitMessages { if mess . Type != Precommit || mess . Round != round || mess . SenderID != ID { return false } } for _ , mess := range vs . ReceivedPrecommitMessages { if mess . Type != Precommit || mess . Round != round { return false } } } return true }
IsValid checks if the height vote set is valid and contains valid data
IsValid checks if the height vote set is valid and contains valid data