diff options
Diffstat (limited to 'tools/certtools.py')
-rw-r--r-- | tools/certtools.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/certtools.py b/tools/certtools.py index fdff0e1..2fb1492 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -549,8 +549,11 @@ def nodes_for_index(pos, treesize): level += 1 return nodes -def verify_consistency_proof(consistency_proof, first, second): +def verify_consistency_proof(consistency_proof, first, second, oldhash_input): + if 2 ** bits(first - 1) == first: + consistency_proof = [oldhash_input] + consistency_proof chain = zip(nodes_for_subtree(first, second), consistency_proof) + assert len(nodes_for_subtree(first, second)) == len(consistency_proof) (_, hash) = reduce(lambda e1, e2: combine_two_hashes(e1, e2, second), chain) (_, oldhash) = reduce(lambda e1, e2: combine_two_hashes(e1, e2, first), chain) return (oldhash, hash) |