in librabft-v2/src/record_store.rs [702:738]
fn check_for_new_quorum_certificate(&mut self, context: &mut Context) -> bool {
match &self.current_election {
ElectionState::Won { block_hash, state } => {
if self.block(*block_hash).unwrap().value.author != context.author() {
return false;
}
let committed_state = self.vote_committed_state(*block_hash);
let authors_and_signatures = self
.current_votes
.iter()
.filter_map(|(_, vote)| {
if vote.value.state == *state {
Some((vote.value.author, vote.signature))
} else {
None
}
})
.collect();
let quorum_certificate = Record::QuorumCertificate(SignedValue::make(
context,
QuorumCertificate_ {
epoch_id: self.epoch_id,
round: self.current_round,
certified_block_hash: *block_hash,
state: state.clone(),
votes: authors_and_signatures,
committed_state,
author: context.author(),
},
));
self.current_election = ElectionState::Closed;
self.insert_network_record(quorum_certificate, context);
true
}
_ => false,
}
}