Skip to content

Commit

Permalink
added presence check
Browse files Browse the repository at this point in the history
  • Loading branch information
AKorpusenko committed Jul 29, 2024
1 parent e1e62db commit 8b3c9c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions protocol/v2/ssv/validator/committee.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ func (c *Committee) StartConsumeQueue(logger *zap.Logger, duty *spectypes.Commit
c.mtx.Lock()
defer c.mtx.Unlock()

q, queueFound := c.Queues[duty.Slot]
if !queueFound {
return errors.New(fmt.Sprintf("no queue found for slot %d", duty.Slot))
}

// required to stop the queue consumer when timeout message is received by handler
queueCtx, cancelF := context.WithCancel(c.ctx)

q, _ := c.Queues[duty.Slot]
q.StopQueueF = cancelF

r := c.Runners[duty.Slot]
Expand All @@ -103,7 +105,6 @@ func (c *Committee) StartConsumeQueue(logger *zap.Logger, duty *spectypes.Commit
go func() {
// Setting the cancel function separately due the queue could be created in HandleMessage


logger = c.logger.With(fields.DutyID(fields.FormatCommitteeDutyID(c.Operator.Committee, c.BeaconNetwork.EstimatedEpochAtSlot(duty.Slot), duty.Slot)), fields.Slot(duty.Slot))

err := c.ConsumeQueue(queueCtx, q, logger, duty.Slot, c.ProcessMessage, r)
Expand Down

0 comments on commit 8b3c9c7

Please sign in to comment.