mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
Pending block queue lock fixes (#8002)
* Unlock in case of error * fix comment * fix comment * revert one defer Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
This commit is contained in:
parent
3bd5e58a5c
commit
f9c696ed54
@ -102,6 +102,7 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
|
||||
// Remove block from queue.
|
||||
s.pendingQueueLock.Lock()
|
||||
if err := s.deleteBlockFromPendingQueue(slot, b, blkRoot); err != nil {
|
||||
s.pendingQueueLock.Unlock()
|
||||
return err
|
||||
}
|
||||
s.pendingQueueLock.Unlock()
|
||||
@ -311,7 +312,7 @@ func (s *Service) deleteBlockFromPendingQueue(slot uint64, b *ethpb.SignedBeacon
|
||||
return nil
|
||||
}
|
||||
|
||||
// Decrease exp itme in proportion to how many blocks are still in the cache for slot key.
|
||||
// Decrease exp time in proportion to how many blocks are still in the cache for slot key.
|
||||
d := pendingBlockExpTime / time.Duration(len(newBlks))
|
||||
if err := s.slotToPendingBlocks.Replace(slotToCacheKey(slot), newBlks, d); err != nil {
|
||||
return err
|
||||
|
@ -123,6 +123,7 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
if !s.db.HasBlock(ctx, bytesutil.ToBytes32(blk.Block.ParentRoot)) {
|
||||
s.pendingQueueLock.Lock()
|
||||
if err := s.insertBlockToPendingQueue(blk.Block.Slot, blk, blockRoot); err != nil {
|
||||
s.pendingQueueLock.Unlock()
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user