clena up get_crosslink_committees_at_slots

This commit is contained in:
Danny Ryan 2019-01-23 15:41:25 -06:00
parent dd075edd06
commit b18de2c86c
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 14 additions and 13 deletions

View File

@ -942,24 +942,25 @@ def get_crosslink_committees_at_slot(state: BeaconState,
state_epoch_slot = state.slot - (state.slot % EPOCH_LENGTH)
assert state_epoch_slot <= slot + EPOCH_LENGTH
assert slot < state_epoch_slot + EPOCH_LENGTH
offset = slot % EPOCH_LENGTH
if slot < state_epoch_slot:
committees_per_slot = get_previous_epoch_committee_count_per_slot(state)
shuffling = get_shuffling(
state.previous_epoch_randao_mix,
state.validator_registry,
state.previous_epoch_calculation_slot,
)
slot_start_shard = (state.previous_epoch_start_shard + committees_per_slot * offset) % SHARD_COUNT
seed = state.previous_epoch_randao_mix
shuffling_slot = state.previous_epoch_calculation_slot
shuffling_start_shard = state.previous_epoch_start_shard
else:
committees_per_slot = get_current_epoch_committee_count_per_slot(state)
seed = state.current_epoch_randao_mix
shuffling_slot = state.current_epoch_calculation_slot
shuffling_start_shard = state.current_epoch_start_shard
shuffling = get_shuffling(
state.current_epoch_randao_mix,
seed,
state.validator_registry,
state.current_epoch_calculation_slot,
shuffling_slot,
)
slot_start_shard = (state.current_epoch_start_shard + committees_per_slot * offset) % SHARD_COUNT
offset = slot % EPOCH_LENGTH
slot_start_shard = (shuffling_start_shard + committees_per_slot * offset) % SHARD_COUNT
return [
(