Use Target Epoch to Determine Indexed Attestations for Slasher (#5085)

* no more head fetchre

* no need for head fetcher

* nil checks
This commit is contained in:
Raul Jordan 2020-03-12 17:02:12 -05:00 committed by GitHub
parent ed7ad4525e
commit c6acf0a28c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,7 +277,14 @@ func (bs *Server) StreamIndexedAttestations(
err,
)
}
epoch := helpers.SlotToEpoch(bs.HeadFetcher.HeadSlot())
if len(aggAtts) == 0 {
continue
}
// All attestations we receive have the same target epoch given they
// have the same data root, so we just use the target epoch from
// the first one to determine committees for converting into indexed
// form.
epoch := aggAtts[0].Data.Target.Epoch
committeesBySlot, _, err := bs.retrieveCommitteesForEpoch(stream.Context(), epoch)
if err != nil {
return status.Errorf(