From 663bc489b60ea89708e6115763ca185628eb3edc Mon Sep 17 00:00:00 2001 From: vbuterin Date: Wed, 6 Mar 2019 22:54:52 -0600 Subject: [PATCH] Added lexicographic tiebreaking --- specs/core/0_beacon-chain.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index 081e877c3..49f8ba3e9 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -2060,7 +2060,9 @@ def get_winning_root_and_participants(state: BeaconState, shard: Shard) -> Tuple def get_attestations_for(root) -> List[PendingAttestation]: return [a for a in valid_attestations if a.data.crosslink_data_root == root] - winning_root = max(all_roots, key=lambda r: get_attesting_balance(state, get_attestations_for(r))) + # Winning crosslink root is the root with the most votes for it, ties broken in favor of + # lexicographically higher hash + winning_root = max(all_roots, key=lambda r: (get_attesting_balance(state, get_attestations_for(r)), r)) return winning_root, get_attesting_indices(state, get_attestations_for(winning_root)) ```