Skip to content

Commit

Permalink
fixed the count of matching AUX messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vkomenda committed May 10, 2018
1 parent 259d536 commit 51ef11b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ring = "^0.12"
protobuf = "1.4.4"
crossbeam = "0.3.2"
crossbeam-channel = "0.1"
itertools = "0.7"

[build-dependencies]
protoc-rust = "1.4.4"
Expand Down
14 changes: 5 additions & 9 deletions src/agreement.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Binary Byzantine agreement protocol from a common coin protocol.
use itertools::Itertools;
use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
use std::hash::Hash;

Expand Down Expand Up @@ -210,17 +211,12 @@ impl<NodeUid: Clone + Eq + Hash> Agreement<NodeUid> {
/// can, however, expect every good node to send an AUX value that will
/// eventually end up in our bin_values.
fn count_aux(&self) -> (usize, BTreeSet<bool>) {
let mut count = 0;
let vals: BTreeSet<bool> = self.received_aux
let (vals_cnt, vals) = self.received_aux
.values()
.filter(|b| {
count += 1;
self.bin_values.contains(b)
})
.cloned()
.collect();
.filter(|b| self.bin_values.contains(b))
.tee();

(count, vals)
(vals_cnt.count(), vals.cloned().collect())
}

/// Waits until at least (N − f) AUX_r messages have been received, such that
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
extern crate log;
extern crate crossbeam;
extern crate crossbeam_channel;
extern crate itertools;
extern crate merkle;
extern crate protobuf;
extern crate reed_solomon_erasure;
Expand Down

0 comments on commit 51ef11b

Please sign in to comment.