This commit is contained in:
terence tsao
2021-09-27 14:06:52 -07:00
parent a515ac56ed
commit da8eda99f9
2 changed files with 4 additions and 0 deletions

View File

@@ -711,6 +711,7 @@ func (vs *Server) filterAttestationsForBlockInclusion(ctx context.Context, st st
ctx, span := trace.StartSpan(ctx, "ProposerServer.filterAttestationsForBlockInclusion")
defer span.End()
// Retrieve parent blocks up to one epoch old.
parentBlock, err := vs.HeadFetcher.HeadBlock(ctx)
if err != nil {
return nil, err

View File

@@ -57,7 +57,9 @@ func (a proposerAtts) filterByValidation(ctx context.Context, st state.BeaconSta
return validAtts, invalidAtts
}
// filterByBlocks filters the attestation list that's not covered by the attestations contained in input `blks`.
func (a proposerAtts) filterByBlocks(ctx context.Context, blks []block.SignedBeaconBlock) (proposerAtts, error) {
// Construct a map of seen attestation bits given the input block's attestations.
seenBits := make(map[[32]byte][]bitfield.Bitlist)
for _, blk := range blks {
for _, att := range blk.Block().Body().Attestations() {
@@ -87,6 +89,7 @@ func (a proposerAtts) filterByBlocks(ctx context.Context, blks []block.SignedBea
}
}
// Filter out attestations that are covered by the constructed map.
filteredAtts := make(proposerAtts, 0, len(a))
for _, att := range a {
r, err := hashFn(att.Data)