Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Fix vote counting in partition_recent_disputes() (code review feedb…
Browse files Browse the repository at this point in the history
…ack)
  • Loading branch information
tdimitrov committed May 23, 2022
1 parent 36e44aa commit b7be63e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions node/core/provisioner/src/disputes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,8 @@ fn partition_recent_disputes(
match onchain.get(&(session_index, candidate_hash)) {
Some(d) => {
// handle double voting here - if a validator has voted both `for` and `against` at the same time for a dispute - ignore its vote
let double_votes =
(d.validators_for.clone() & d.validators_against.clone()).count_ones() * 2;
if d.validators_for.count_ones() + d.validators_against.count_ones() - double_votes >=
// XOR-ing `for` and `against` gives exactly that
if (d.validators_for.clone() ^ &d.validators_against).count_ones() >=
supermajority_threshold(d.validators_for.len())
{
partitioned.can_conclude_onchain.push((session_index, candidate_hash));
Expand Down

0 comments on commit b7be63e

Please sign in to comment.