Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit d9e58c2

Browse files
author
naterush
committed
fix bug in forkchoice
1 parent 677a728 commit d9e58c2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

casper/protocols/sharding/forkchoice.py

+9
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ def get_shard_fork_choice(starting_block, children, latest_messages, shard_id):
4141
for child in children[best_block]:
4242
if not child.on_shard(shard_id):
4343
continue # we only select children on the same shard
44+
# can't pick a child that a merge block with a higher shard
45+
if child.is_merge_block:
46+
not_in_forkchoice = False
47+
for shard in child.estimate['shard_ids']:
48+
if len(shard) < len(shard_id):
49+
not_in_forkchoice = True
50+
break
51+
if not_in_forkchoice:
52+
continue
4453
curr_scores[child] = scores.get(child, 0)
4554
max_score = max(curr_scores[child], max_score)
4655

0 commit comments

Comments
 (0)