Index from GENESIS_SLOT in compute_time_at_slot

Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
Mikhail Kalinin 2021-03-17 15:19:58 +06:00
parent ee161634b2
commit f6f36872d8

View File

@ -163,7 +163,8 @@ def compute_randao_mix(state: BeaconState, randao_reveal: BLSSignature) -> Bytes
```python
def compute_time_at_slot(state: BeaconState, slot: Slot) -> uint64:
return uint64(state.genesis_time + slot * SECONDS_PER_SLOT)
slots_since_genesis = slot - GENESIS_SLOT
return uint64(state.genesis_time + slots_since_genesis * SECONDS_PER_SLOT)
```
### Beacon state accessors