Skip to content

Commit

Permalink
Merge 3ae7cd9 into 8bd19f4
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths authored Dec 9, 2023
2 parents 8bd19f4 + 3ae7cd9 commit 23cc705
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,16 @@ export class AggregatedAttestationPool {
}
}

return attestationsByScore
.sort((a, b) => b.score - a.score)
.slice(0, MAX_ATTESTATIONS)
.map((attestation) => attestation.attestation);
const sortedAttestationsByScore = attestationsByScore.sort((a, b) => b.score - a.score);
const attestationsForBlock: phase0.Attestation[] = [];
for (const [i, attestationWithScore] of sortedAttestationsByScore.entries()) {
if (i >= MAX_ATTESTATIONS) {
break;
}
// attestations could be modified in this op pool, so we need to clone for block
attestationsForBlock.push(ssz.phase0.Attestation.clone(attestationWithScore.attestation));
}
return attestationsForBlock;
}

/**
Expand Down

0 comments on commit 23cc705

Please sign in to comment.