mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-03 04:54:57 -05:00
Cleanup merkle_root
Add docstring and fix spacing.
This commit is contained in:
@@ -954,10 +954,13 @@ def get_beacon_proposer_index(state: BeaconState,
|
||||
#### `merkle_root`
|
||||
|
||||
```python
|
||||
def merkle_root(values):
|
||||
def merkle_root(values):
|
||||
"""
|
||||
Merkleize ``values`` (where ``len(values)`` is a power of two) and return the Merkle root.
|
||||
"""
|
||||
o = [0] * len(values) + values
|
||||
for i in range(len(values)-1, 0, -1):
|
||||
o[i] = hash(o[i*2] + o[i*2+1])
|
||||
for i in range(len(values) - 1, 0, -1):
|
||||
o[i] = hash(o[i * 2] + o[i * 2 + 1])
|
||||
return o[1]
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user