Merge pull request #2092 from ethereum/ralexstokes-patch-1

Simplify fork choice spec
This commit is contained in:
Danny Ryan 2020-11-03 06:58:35 -07:00 committed by GitHub
commit bfaef689e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -226,11 +226,10 @@ def get_head(store: Store) -> Root:
blocks = get_filtered_block_tree(store)
# Execute the LMD-GHOST fork choice
head = store.justified_checkpoint.root
justified_slot = compute_start_slot_at_epoch(store.justified_checkpoint.epoch)
while True:
children = [
root for root in blocks.keys()
if blocks[root].parent_root == head and blocks[root].slot > justified_slot
if blocks[root].parent_root == head
]
if len(children) == 0:
return head