From d0192f3687cec2b3b2c256298f6a1dca9168ab4f Mon Sep 17 00:00:00 2001 From: muXxer Date: Fri, 17 May 2024 17:15:45 +0200 Subject: [PATCH] Fix panic in DRR scheduler --- .../scheduler/drr/scheduler.go | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go index 37fd2dd2d..6d576ab90 100644 --- a/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go +++ b/pkg/protocol/engine/congestioncontrol/scheduler/drr/scheduler.go @@ -595,17 +595,19 @@ func (s *Scheduler) selectIssuer(slot iotago.SlotIndex) (Deficit, *IssuerQueue) func (s *Scheduler) removeIssuer(issuerID iotago.AccountID, err error) { q := s.basicBuffer.IssuerQueue(issuerID) - q.nonReadyMap.ForEach(func(_ iotago.BlockID, block *blocks.Block) bool { - block.SetDropped() - s.events.BlockDropped.Trigger(block, err) + if q != nil { + q.nonReadyMap.ForEach(func(_ iotago.BlockID, block *blocks.Block) bool { + block.SetDropped() + s.events.BlockDropped.Trigger(block, err) - return true - }) + return true + }) - for i := range q.readyHeap.Len() { - block := q.readyHeap[i].Value - block.SetDropped() - s.events.BlockDropped.Trigger(block, err) + for i := range q.readyHeap.Len() { + block := q.readyHeap[i].Value + block.SetDropped() + s.events.BlockDropped.Trigger(block, err) + } } s.deficits.Delete(issuerID)