Merge pull request #397 from ralexstokes/fix-merkle-bug

Fixes bug with Merkle proof branch selection
This commit is contained in:
Danny Ryan 2019-01-07 09:45:42 -07:00 committed by GitHub
commit 14e14ce576
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1478,7 +1478,7 @@ For each `deposit` in `block.body.deposits`:
def verify_merkle_branch(leaf: Hash32, branch: [Hash32], depth: int, index: int, root: Hash32) -> bool:
value = leaf
for i in range(depth):
if index % 2:
if index // (2**i) % 2:
value = hash(branch[i] + value)
else:
value = hash(value + branch[i])