Clarify merkle_root documentation (#646)

This function is used to get the merkle root of some block roots which are themselves hashes, so the leaves do not need to be rehashed.
Unfortunately, it's easy to assume that a merkle_root function would hash its leaves, so it should be clarified.
This commit is contained in:
Cayman 2019-02-17 21:11:01 -07:00 committed by Hsiao-Wei Wang
parent eea413bcc5
commit 5fbbb4f181
1 changed files with 1 additions and 0 deletions

View File

@ -995,6 +995,7 @@ def get_beacon_proposer_index(state: BeaconState,
def merkle_root(values: List[Bytes32]) -> Bytes32: def merkle_root(values: List[Bytes32]) -> Bytes32:
""" """
Merkleize ``values`` (where ``len(values)`` is a power of two) and return the Merkle root. Merkleize ``values`` (where ``len(values)`` is a power of two) and return the Merkle root.
Note that the leaves are not hashed.
""" """
o = [0] * len(values) + values o = [0] * len(values) + values
for i in range(len(values) - 1, 0, -1): for i in range(len(values) - 1, 0, -1):