@@ -65,11 +65,11 @@ def set_child_starting_block(self, tip_block, parent_id, child_id):
65
65
66
66
def select_random_shards (self , shards_forkchoice ):
67
67
"""Randomly selects a shard to build on, and sometimes selects another child shard"""
68
- shards_to_build_on = [r .choice ([ key for key in self .starting_blocks .keys ()] )]
69
- if ( r . randint ( 0 , 1 ) == 1 ):
70
- child = str (r .randint (0 , 1 ))
71
- if shards_to_build_on [ 0 ] + child in self .starting_blocks :
72
- shards_to_build_on .append (shards_to_build_on [ 0 ] + child )
68
+ shards_to_build_on = [r .choice (list ( self .starting_blocks .keys ()) )]
69
+ if r . choice ([ True , False ] ):
70
+ child_shard_id = shards_to_build_on [ 0 ] + str (r .randint (0 , 1 ))
71
+ if child_shard_id in self .starting_blocks :
72
+ shards_to_build_on .append (child_shard_id )
73
73
74
74
return set (shards_to_build_on )
75
75
@@ -113,18 +113,6 @@ def update_safe_estimates(self, validator_set):
113
113
# check the safety of the top shard!
114
114
pass
115
115
116
- tip = None
117
-
118
- while tip and tip != self .starting_blocks ['' ]:
119
- oracle = CliqueOracle (tip , self , validator_set )
120
- fault_tolerance , _ = oracle .check_estimate_safety ()
121
-
122
- if fault_tolerance > 0 :
123
- self .starting_blocks ['' ] = tip
124
- return tip
125
-
126
- tip = tip .prev_block ('' )
127
-
128
116
def _update_protocol_specific_view (self , message ):
129
117
"""Given a now justified message, updates children and when_recieved"""
130
118
assert message .hash in self .justified_messages , "...should not have seen message!"
0 commit comments