Clarify lexicographic hash favoring (#881)

This commit is contained in:
vbuterin 2019-04-06 04:07:26 -05:00 committed by Justin
parent 690e4faff7
commit 199e7849da
1 changed files with 1 additions and 0 deletions

View File

@ -1664,6 +1664,7 @@ def lmd_ghost(store: Store, start_state: BeaconState, start_block: BeaconBlock)
children = get_children(store, head) children = get_children(store, head)
if len(children) == 0: if len(children) == 0:
return head return head
# Ties broken by favoring block with lexicographically higher root
head = max(children, key=lambda x: (get_vote_count(x), hash_tree_root(x))) head = max(children, key=lambda x: (get_vote_count(x), hash_tree_root(x)))
``` ```