PR feedback from Terence and Danny: refactor `get_committee_count_delta`

This commit is contained in:
Hsiao-Wei Wang 2020-06-01 23:22:59 +08:00
parent 30f72dd696
commit 5f10ac13bf
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 2 additions and 6 deletions

View File

@ -558,13 +558,9 @@ def get_indexed_attestation(beacon_state: BeaconState, attestation: Attestation)
```python
def get_committee_count_delta(state: BeaconState, start_slot: Slot, stop_slot: Slot) -> uint64:
"""
Return the sum of committee counts between ``[start_slot, stop_slot)``.
Return the sum of committee counts in range ``[start_slot, stop_slot)``.
"""
committee_sum = 0
for slot in range(start_slot, stop_slot):
count = get_committee_count_at_slot(state, Slot(slot))
committee_sum += count
return committee_sum
return sum(get_committee_count_at_slot(state, Slot(slot)) for slot in range(start_slot, stop_slot))
```
#### `get_start_shard`