Apply suggestions from @djrtwo

This commit is contained in:
Aditya Asgaonkar 2023-03-14 14:49:41 -07:00
parent 3de96f7a19
commit 1a2967a542

View File

@ -189,10 +189,6 @@ def get_ancestor(store: Store, root: Root, slot: Slot) -> Root:
block = store.blocks[root]
if block.slot > slot:
return get_ancestor(store, block.parent_root, slot)
elif block.slot == slot:
return root
else:
# root is older than queried slot, thus a skip slot. Return most recent root prior to slot
return root
```
@ -274,9 +270,8 @@ def filter_block_tree(store: Store, block_root: Root, blocks: Dict[Root, BeaconB
or voting_source.epoch == store.justified_checkpoint.epoch
)
# If the block should be pulled-up due to previous epoch being justified, also check
# that the unrealized justification is higher than the store's justified
# checkpoint, and the voting source is not more than two epochs ago.
# If the previous epoch is justified, the block should be pulled-up. In this case, check that unrealized
# justification is higher than the store and that the voting source is not more than two epochs ago
if not correct_justified and is_previous_epoch_justified(store):
correct_justified = (
store.unrealized_justifications[block_root].epoch >= store.justified_checkpoint.epoch and
@ -470,9 +465,7 @@ def store_target_checkpoint_state(store: Store, target: Checkpoint) -> None:
##### `update_latest_messages`
```python
def update_latest_messages(store: Store,
attesting_indices: Sequence[ValidatorIndex],
attestation: Attestation) -> None:
def update_latest_messages(store: Store, attesting_indices: Sequence[ValidatorIndex], attestation: Attestation) -> None:
target = attestation.data.target
beacon_block_root = attestation.data.beacon_block_root
non_equivocating_attesting_indices = [i for i in attesting_indices if i not in store.equivocating_indices]