stop tracking phase0 spec artifact of current/prev target epoch for attestation block packing (#6508)

This commit is contained in:
tersec 2024-08-22 18:28:21 +00:00 committed by GitHub
parent 44cc72c104
commit e4f18cba09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 15 deletions

View File

@ -751,15 +751,6 @@ proc getAttestationsForBlock*(pool: var AttestationPool,
#
# For each round, we'll look for the best attestation and add it to the result
# then re-score the other candidates.
var
prevEpoch = state.data.get_previous_epoch()
prevEpochSpace =
when not (state is phase0.HashedBeaconState):
MAX_ATTESTATIONS
else:
state.data.previous_epoch_attestations.maxLen -
state.data.previous_epoch_attestations.len()
var res: seq[phase0.Attestation]
let totalCandidates = candidates.len()
while candidates.len > 0 and res.lenu64() < MAX_ATTESTATIONS:
@ -775,12 +766,6 @@ proc getAttestationsForBlock*(pool: var AttestationPool,
candidates.del(candidate) # careful, `del` reorders candidates
if entry[].data.target.epoch == prevEpoch:
if prevEpochSpace < 1:
continue # No need to rescore since we didn't add the attestation
prevEpochSpace -= 1
res.add(entry[].toAttestation(entry[].aggregates[j]))
# Update cache so that the new votes are taken into account when updating