Move state trans fns into state_processing

This commit is contained in:
Paul Hauner
2019-03-18 21:34:42 +11:00
parent 7503f31ddc
commit 1028acf3f1
17 changed files with 741 additions and 669 deletions

View File

@@ -0,0 +1,20 @@
use types::*;
/// Verify ``bitfield`` against the ``committee_size``.
///
/// Is title `verify_bitfield` in spec.
///
/// Spec v0.4.0
pub fn verify_bitfield_length(bitfield: &Bitfield, committee_size: usize) -> bool {
if bitfield.num_bytes() != ((committee_size + 7) / 8) {
return false;
}
for i in committee_size..(bitfield.num_bytes() * 8) {
if bitfield.get(i).unwrap_or(false) {
return false;
}
}
true
}