From 496adc0f0b7e12c5842f7f1507933d82a1747d6e Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Sun, 30 Sep 2018 14:24:42 +0930 Subject: [PATCH] Fix bug in attestation val. bitfield checking There was a logic error --- .../attestation_record/validation/attestation_validation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lighthouse/state/attestation_record/validation/attestation_validation.rs b/lighthouse/state/attestation_record/validation/attestation_validation.rs index db2a781de..1c0b149d8 100644 --- a/lighthouse/state/attestation_record/validation/attestation_validation.rs +++ b/lighthouse/state/attestation_record/validation/attestation_validation.rs @@ -161,7 +161,7 @@ fn bytes_for_bits(bits: usize) -> usize { fn any_of_last_n_bits_are_set(byte: u8, n: usize) -> bool { for i in 0..n { - let mask = 0_u8 >> 8_usize - i as usize; + let mask = 1_u8 >> 7_usize.saturating_sub(i as usize); if byte & mask > 0 { return true }