Skip to content

Commit

Permalink
Caplin: fixed mem-leak (#12733)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored Nov 15, 2024
1 parent 871a242 commit bb0c46b
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions cl/phase1/network/services/blob_sidecar_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"errors"
"fmt"
"sync"
"time"

"github.com/Giulio2002/bls"
Expand All @@ -47,8 +46,8 @@ type blobSidecarService struct {
ethClock eth_clock.EthereumClock
emitters *beaconevents.EventEmitter

blobSidecarsScheduledForLaterExecution sync.Map
test bool
// blobSidecarsScheduledForLaterExecution sync.Map
test bool
}

type blobSidecarJob struct {
Expand Down Expand Up @@ -115,7 +114,7 @@ func (b *blobSidecarService) ProcessMessage(ctx context.Context, subnetId *uint6

parentHeader, has := b.forkchoiceStore.GetHeader(msg.SignedBlockHeader.Header.ParentRoot)
if !has {
b.scheduleBlobSidecarForLaterExecution(msg)
//b.scheduleBlobSidecarForLaterExecution(msg)
return ErrIgnore
}
if msg.SignedBlockHeader.Header.Slot <= parentHeader.Slot {
Expand Down Expand Up @@ -195,17 +194,17 @@ func (b *blobSidecarService) verifySidecarsSignature(header *cltypes.SignedBeaco
return nil
}

func (b *blobSidecarService) scheduleBlobSidecarForLaterExecution(blobSidecar *cltypes.BlobSidecar) {
blobSidecarJob := &blobSidecarJob{
blobSidecar: blobSidecar,
creationTime: time.Now(),
}
blobSidecarHash, err := blobSidecar.HashSSZ()
if err != nil {
return
}
b.blobSidecarsScheduledForLaterExecution.Store(blobSidecarHash, blobSidecarJob)
}
// func (b *blobSidecarService) scheduleBlobSidecarForLaterExecution(blobSidecar *cltypes.BlobSidecar) {
// blobSidecarJob := &blobSidecarJob{
// blobSidecar: blobSidecar,
// creationTime: time.Now(),
// }
// blobSidecarHash, err := blobSidecar.HashSSZ()
// if err != nil {
// return
// }
// b.blobSidecarsScheduledForLaterExecution.Store(blobSidecarHash, blobSidecarJob)
// }

// // loop is the main loop of the block service
// func (b *blobSidecarService) loop(ctx context.Context) {
Expand Down

0 comments on commit bb0c46b

Please sign in to comment.