// Check if a process is faulty in every round and detect all the faultiness reasons for it
Check if a process is faulty in every round and detect all the faultiness reasons for it
// Check if a process is faulty in every round and detect all the faultiness reasons for it
func (acc *Accountability) isProcessFaulty(firstDecisionRound, secondDecisionRound uint64, processID string, wg *sync.WaitGroup) {
	var lockedValue *common.Value
	lockedRound := int64(-1)
	hvs := acc.heightLogs.messageLogs[processID]
	isHvsReceived := acc.heightLogs.receivedLogsMap[processID]
	for round := firstDecisionRound; round <= secondDecisionRound; round++ {
		vs, vsLoad := hvs.VoteSetMap[round]
		if vs == nil || !vsLoad {
			continue
		}
		acc.checkForEquivocation(processID, round, vs)
		if isHvsReceived {
			if len(vs.SentPrevoteMessages) == 1 && lockedValue != nil {
				message := vs.SentPrevoteMessages[0]
				if message.Value != nil {
					if acc.asyncMode {
						if !acc.checkQuorumJustificationsForPrevote(hvs, lockedValue, lockedRound, message) {
							acc.faultySet.AddFaultiness(processID, round, faultinessMissingJustificationsForPrevote)
						}
					} else {
						if !acc.checkQuorumPrevotesForPrevote(hvs, lockedValue, lockedRound, message) {
							acc.faultySet.AddFaultiness(processID, round, faultinessMissingQuorumForPrevote)
						}
					}
				}
			}
			if len(vs.SentPrecommitMessages) == 1 {
				message := vs.SentPrecommitMessages[0]
				if message.Value != nil {
					if !acc.checkQuorumPrevotesForPrecommit(vs, message) {
						acc.faultySet.AddFaultiness(processID, round, faultinessMissingQuorumForPrecommit)
					}
					lockedValue = common.NewValue(message.Value.Data)
					lockedRound = int64(round)
				}
			}
		} else {
			if !acc.asyncMode {
				acc.faultySet.AddFaultiness(processID, 0, faultinessMissingHvs)
			}
		}
	}
	wg.Done()
}
func ( acc * Accountability ) isProcessFaulty ( firstDecisionRound , secondDecisionRound uint64 , processID string , wg * sync . WaitGroup ) { var lockedValue * common . Value lockedRound := int64 ( - 1 ) hvs := acc . heightLogs . messageLogs [ processID ] isHvsReceived := acc . heightLogs . receivedLogsMap [ processID ] for round := firstDecisionRound ; round <= secondDecisionRound ; round ++ { vs , vsLoad := hvs . VoteSetMap [ round ] if vs == nil || ! vsLoad { continue } acc . checkForEquivocation ( processID , round , vs ) if isHvsReceived { if len ( vs . SentPrevoteMessages ) == 1 && lockedValue != nil { message := vs . SentPrevoteMessages [ 0 ] if message . Value != nil { if acc . asyncMode { if ! acc . checkQuorumJustificationsForPrevote ( hvs , lockedValue , lockedRound , message ) { acc . faultySet . AddFaultiness ( processID , round , faultinessMissingJustificationsForPrevote ) } } else { if ! acc . checkQuorumPrevotesForPrevote ( hvs , lockedValue , lockedRound , message ) { acc . faultySet . AddFaultiness ( processID , round , faultinessMissingQuorumForPrevote ) } } } } if len ( vs . SentPrecommitMessages ) == 1 { message := vs . SentPrecommitMessages [ 0 ] if message . Value != nil { if ! acc . checkQuorumPrevotesForPrecommit ( vs , message ) { acc . faultySet . AddFaultiness ( processID , round , faultinessMissingQuorumForPrecommit ) } lockedValue = common . NewValue ( message . Value . Data ) lockedRound = int64 ( round ) } } } else { if ! acc . asyncMode { acc . faultySet . AddFaultiness ( processID , 0 , faultinessMissingHvs ) } } } wg . Done ( ) }
Check if a process is faulty in every round and detect all the faultiness reasons for it
Check if a process is faulty in every round and detect all the faultiness reasons for it
// go from the first to the last round (the order is important) // if process doesn't have a voteset, just go to the next round // check if process equivocated in the round // if height vote set was not received, we can only check for equivocation in the async case // if only one prevote message has been sent AND the process had previously sent precommit for some value // Only if two values are not the same, we should look for 2f + 1 prevote messages // if only one precommit message has been sent // we should look for 2f + 1 prevote messages // set lock value and lock round // hvs was not received