From 867dea3473733946d0eb51b8e3132eb3ccacfb2c Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Tue, 5 Feb 2019 19:16:10 +0800 Subject: [PATCH] Fix `verify_bitfield` --- specs/core/0_beacon-chain.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index cc78c8b71..ed5d1b3b3 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -1099,9 +1099,11 @@ def verify_bitfield(bitfield: bytes, committee_size: int) -> bool: if len(bitfield) != (committee_size + 7) // 8: return False - for i in range(committee_size + 1, committee_size - committee_size % 8 + 8): - if get_bitfield_bit(bitfield, i) == 0b1: - return False + # Check if `bitfield` has padding zeros + if committee_size % 8 != 0: + for i in range(committee_size, committee_size - committee_size % 8 + 8): + if get_bitfield_bit(bitfield, i) == 0b1: + return False return True ```