parent
44d2f44993
commit
8c12896fa0
|
@ -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]
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue