Send missing slot event at the correct place (#12160)

This commit is contained in:
terencechain 2023-03-19 16:25:58 -07:00 committed by GitHub
parent d1c45b44be
commit 6480d5a0fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -671,9 +671,6 @@ func (s *Service) fillMissingPayloadIDRoutine(ctx context.Context, stateFeed *ev
for {
select {
case <-ticker.C():
s.cfg.StateNotifier.StateFeed().Send(&feed.Event{
Type: statefeed.MissedSlot,
})
if err := s.fillMissingBlockPayloadId(ctx); err != nil {
log.WithError(err).Error("Could not fill missing payload ID")
}
@ -692,6 +689,10 @@ func (s *Service) fillMissingBlockPayloadId(ctx context.Context) error {
if s.CurrentSlot() == s.HeadSlot() {
return nil
}
s.cfg.StateNotifier.StateFeed().Send(&feed.Event{
Type: statefeed.MissedSlot,
})
// Head root should be empty when retrieving proposer index for the next slot.
_, id, has := s.cfg.ProposerSlotIndexCache.GetProposerPayloadIDs(s.CurrentSlot()+1, [32]byte{} /* head root */)
// There exists proposer for next slot, but we haven't called fcu w/ payload attribute yet.