Skip to content

Commit

Permalink
log inconsistent bitfield state
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Aug 28, 2018
1 parent 012c122 commit 709274a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
parking_lot = "0.4"
log = "0.4"
6 changes: 4 additions & 2 deletions src/bitfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,13 @@ impl<Id: Eq> LiveBitfield<Id> {
let word_off = bit_idx / 64;
let bit_off = bit_idx % 64;

// TODO: if this isn't `Some`, something has gone really wrong.
// log it?
// If this isn't `Some`, something has gone really wrong.
if let Some(word) = self.bits.get_mut(word_off) {
// set bit starting from left.
*word |= 1 << (63 - bit_off)
} else {
warn!(target: "afg", "Could not set bit {}. Bitfield was meant to have 2 bits for each of {} validators.",
bit_idx, self.shared.n_validators);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
//! https://hackmd.io/iA4XazxWRJ21LqMxwPSEZg?view

extern crate parking_lot;
#[macro_use]
extern crate log;

pub mod bitfield;
pub mod round;
Expand Down

0 comments on commit 709274a

Please sign in to comment.