bugfix: don't forget about var-length bytes getting a length mixin

This commit is contained in:
protolambda 2019-05-28 00:51:27 +02:00
parent 9e61cc2ed3
commit 5e28adf556
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623

View File

@ -110,7 +110,7 @@ def hash_tree_root(obj, typ):
else:
leaves = [hash_tree_root(elem, subtype) for elem in obj]
leaf_root = merkleize_chunks(leaves)
return mix_in_length(leaf_root, len(obj)) if is_list_type(typ) else leaf_root
return mix_in_length(leaf_root, len(obj)) if is_list_kind(typ) else leaf_root
elif is_container_type(typ):
leaves = [hash_tree_root(field_value, field_typ) for field_value, field_typ in obj.get_typed_values()]
return merkleize_chunks(chunkify(b''.join(leaves)))