Move is_previous_epoch_justified
This commit is contained in:
parent
3c8114cf4c
commit
b7f3d37a52
|
@ -11,8 +11,8 @@
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Helpers](#helpers)
|
- [Helpers](#helpers)
|
||||||
- [`LatestMessage`](#latestmessage)
|
- [`LatestMessage`](#latestmessage)
|
||||||
- [`is_previous_epoch_justified`](#is_previous_epoch_justified)
|
|
||||||
- [`Store`](#store)
|
- [`Store`](#store)
|
||||||
|
- [`is_previous_epoch_justified`](#is_previous_epoch_justified)
|
||||||
- [`get_forkchoice_store`](#get_forkchoice_store)
|
- [`get_forkchoice_store`](#get_forkchoice_store)
|
||||||
- [`get_slots_since_genesis`](#get_slots_since_genesis)
|
- [`get_slots_since_genesis`](#get_slots_since_genesis)
|
||||||
- [`get_current_slot`](#get_current_slot)
|
- [`get_current_slot`](#get_current_slot)
|
||||||
|
@ -92,17 +92,6 @@ class LatestMessage(object):
|
||||||
root: Root
|
root: Root
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### `is_previous_epoch_justified`
|
|
||||||
|
|
||||||
```python
|
|
||||||
def is_previous_epoch_justified(store: Store) -> bool:
|
|
||||||
current_slot = get_current_slot(store)
|
|
||||||
current_epoch = compute_epoch_at_slot(current_slot)
|
|
||||||
return store.justified_checkpoint.epoch + 1 == current_epoch
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### `Store`
|
#### `Store`
|
||||||
|
|
||||||
The `Store` is responsible for tracking information required for the fork choice algorithm. The important fields being tracked are described below:
|
The `Store` is responsible for tracking information required for the fork choice algorithm. The important fields being tracked are described below:
|
||||||
|
@ -130,6 +119,15 @@ class Store(object):
|
||||||
unrealized_justifications: Dict[Root, Checkpoint] = field(default_factory=dict)
|
unrealized_justifications: Dict[Root, Checkpoint] = field(default_factory=dict)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `is_previous_epoch_justified`
|
||||||
|
|
||||||
|
```python
|
||||||
|
def is_previous_epoch_justified(store: Store) -> bool:
|
||||||
|
current_slot = get_current_slot(store)
|
||||||
|
current_epoch = compute_epoch_at_slot(current_slot)
|
||||||
|
return store.justified_checkpoint.epoch + 1 == current_epoch
|
||||||
|
```
|
||||||
|
|
||||||
#### `get_forkchoice_store`
|
#### `get_forkchoice_store`
|
||||||
|
|
||||||
The provided anchor-state will be regarded as a trusted state, to not roll back beyond.
|
The provided anchor-state will be regarded as a trusted state, to not roll back beyond.
|
||||||
|
|
Loading…
Reference in New Issue