Merge pull request #397 from ralexstokes/fix-merkle-bug
Fixes bug with Merkle proof branch selection
This commit is contained in:
commit
14e14ce576
|
@ -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:
|
def verify_merkle_branch(leaf: Hash32, branch: [Hash32], depth: int, index: int, root: Hash32) -> bool:
|
||||||
value = leaf
|
value = leaf
|
||||||
for i in range(depth):
|
for i in range(depth):
|
||||||
if index % 2:
|
if index // (2**i) % 2:
|
||||||
value = hash(branch[i] + value)
|
value = hash(branch[i] + value)
|
||||||
else:
|
else:
|
||||||
value = hash(value + branch[i])
|
value = hash(value + branch[i])
|
||||||
|
|
Loading…
Reference in New Issue