Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct consensus bug #4102

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions massa-consensus-worker/src/state/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,13 @@ impl ConsensusState {
// short-circuiting intersection of cliques from smallest to largest
let mut indices: Vec<usize> = (0..self.max_cliques.len()).collect();
indices.sort_unstable_by_key(|&i| self.max_cliques[i].block_ids.len());
let mut final_candidates = self.max_cliques[indices[0]].block_ids.clone();
for i in 1..indices.len() {
final_candidates.retain(|v| self.max_cliques[i].block_ids.contains(v));
let mut indices_iter = indices.iter();
let mut final_candidates = self.max_cliques
[*indices_iter.next().expect("expected at least one clique")]
.block_ids
.clone();
for i in indices_iter {
final_candidates.retain(|v| self.max_cliques[*i].block_ids.contains(v));
if final_candidates.is_empty() {
break;
}
Expand Down