diff --git a/substrate/candidate-agreement/src/bft/accumulator.rs b/substrate/candidate-agreement/src/bft/accumulator.rs index 42e5459392..e457bef859 100644 --- a/substrate/candidate-agreement/src/bft/accumulator.rs +++ b/substrate/candidate-agreement/src/bft/accumulator.rs @@ -91,6 +91,10 @@ struct VoteCounts { } /// Accumulates messages for a given round of BFT consensus. +/// +/// This isn't tied to the "view" of a single validator. It +/// keeps accurate track of the state of the BFT consensus based +/// on all messages imported. #[derive(Debug)] pub struct Accumulator where @@ -197,12 +201,12 @@ impl Accumulator= self.threshold { Some(digest) } else { None @@ -217,16 +221,16 @@ impl Accumulator false, }; - if let (true, Some(prepared_for)) = (valid_transition, prepared_for) { + if let (true, Some(threshold_prepared)) = (valid_transition, threshold_prepared) { let signatures = self.prepares .values() - .filter(|&&(ref d, _)| d == &prepared_for) + .filter(|&&(ref d, _)| d == &threshold_prepared) .map(|&(_, ref s)| s.clone()) .collect(); self.state = State::Prepared(PrepareJustification { round_number: self.round_number, - digest: prepared_for, + digest: threshold_prepared, signatures: signatures, }); } @@ -240,12 +244,12 @@ impl Accumulator= self.threshold { Some(digest) } else { None @@ -258,16 +262,16 @@ impl Accumulator Accumulator