minor adjustment to not repeat committe count calc

This commit is contained in:
Danny Ryan 2019-03-19 11:40:24 -06:00
parent f5826e7f1c
commit f7fab30772
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 2 additions and 3 deletions

View File

@ -908,14 +908,13 @@ def get_crosslink_committees_at_slot(state: BeaconState,
shuffling_start_shard = state.current_shuffling_start_shard shuffling_start_shard = state.current_shuffling_start_shard
indices = get_active_validator_indices(state.validator_registry, shuffling_epoch) indices = get_active_validator_indices(state.validator_registry, shuffling_epoch)
committee_count = get_epoch_committee_count(len(indices)) committees_per_slot = committees_per_epoch // SLOTS_PER_EPOCH
committees_per_slot = committee_count // SLOTS_PER_EPOCH
offset = slot % SLOTS_PER_EPOCH offset = slot % SLOTS_PER_EPOCH
slot_start_shard = (shuffling_start_shard + committees_per_slot * offset) % SHARD_COUNT slot_start_shard = (shuffling_start_shard + committees_per_slot * offset) % SHARD_COUNT
return [ return [
( (
compute_committee(indices, seed, committees_per_slot * offset + i, committee_count), compute_committee(indices, seed, committees_per_slot * offset + i, committees_per_epoch),
(slot_start_shard + i) % SHARD_COUNT, (slot_start_shard + i) % SHARD_COUNT,
) )
for i in range(committees_per_slot) for i in range(committees_per_slot)