in librabft-v2/src/record_store.rs [801:831]
fn unknown_records(&self, known_qc_rounds: BTreeSet<Round>) -> Vec<Record<Context>> {
let highest_qc_hash = self.highest_quorum_certificate_hash;
let highest_cc_hash = self
.highest_commit_certificate_hash
.unwrap_or(self.initial_hash);
let chain1: Vec<_> = BackwardQuorumCertificateIterator::new(self, highest_qc_hash)
.take_while(|qc| !known_qc_rounds.contains(&qc.value.round))
.collect();
let chain2: Vec<_> = BackwardQuorumCertificateIterator::new(self, highest_cc_hash)
.take_while(|qc| !known_qc_rounds.contains(&qc.value.round))
.collect();
let qcs = crate::util::merge_sort(chain1.into_iter(), chain2.into_iter(), |qc1, qc2| {
qc2.value.round.cmp(&qc1.value.round)
});
let mut result = Vec::new();
for n in (0..qcs.len()).rev() {
let qc = qcs[n];
let block = self.block(qc.value.certified_block_hash).unwrap();
result.push(Record::Block(block.clone()));
result.push(Record::QuorumCertificate(qc.clone()));
}
// Copying timeouts again.
for timeout in self.timeouts() {
result.push(Record::Timeout(timeout.clone()));
}
// Skipping votes intentionally.
if let Some(block_hash) = &self.current_proposed_block {
result.push(Record::Block(self.block(*block_hash).unwrap().clone()));
}
result
}