Skip to content

Commit b60105a

Browse files
Review
1 parent 1a5dcf8 commit b60105a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

consensus/src/extension/election.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ impl<U: UnitWithParents> CandidateElection<U> {
102102
return Ok(());
103103
}
104104
let relative_round = voter.round() - self.round;
105-
let direct_parents = voter.direct_parents().cloned().collect();
106105
let vote = match relative_round {
107106
0 => unreachable!("just checked that voter and election rounds are not equal"),
108107
// Direct descendands vote for, all other units of that round against.
109108
1 => voter.parent_for(self.candidate_creator) == Some(&self.candidate_hash),
110109
// Otherwise we compute the vote based on the parents' votes.
111110
_ => {
112111
let threshold = voter.node_count().consensus_threshold();
112+
let direct_parents = voter.direct_parents().cloned().collect();
113113
self.vote_from_parents(direct_parents, threshold, relative_round)?
114114
}
115115
};

consensus/src/testing/dag.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl DagFeeder {
139139

140140
fn on_reconstructed_unit(&mut self, unit: ReconstructedUnit) {
141141
let h = unit.hash();
142-
let parents = unit.parents().cloned().collect::<Vec<_>>();
142+
let parents: HashSet<_> = unit.parents().cloned().collect();
143143
let expected_hashes: HashSet<_> = self
144144
.units_map
145145
.get(&h)
@@ -148,7 +148,7 @@ impl DagFeeder {
148148
.into_iter()
149149
.collect();
150150

151-
assert_eq!(parents.into_iter().collect::<HashSet<_>>(), expected_hashes);
151+
assert_eq!(parents, expected_hashes);
152152
self.result.push(unit.clone());
153153
self.store.insert(unit);
154154
}

0 commit comments

Comments
 (0)