From b51c467084a8d0c5a93545c5f1e367af499f9d07 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Mon, 3 Apr 2023 22:43:14 +0800 Subject: [PATCH] init jobs maps --- statediff/service.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/statediff/service.go b/statediff/service.go index 8a8c570f8..acfe9574c 100644 --- a/statediff/service.go +++ b/statediff/service.go @@ -221,6 +221,8 @@ func New(stack *node.Node, ethServ *eth.Ethereum, cfg *ethconfig.Config, params enableWriteLoop: params.EnableWriteLoop, numWorkers: workers, maxRetry: defaultRetryLimit, + jobStatusSubs: map[rpc.ID]statusSubscription{}, + currentJobs: map[uint64]JobID{}, } stack.RegisterLifecycle(sds) stack.RegisterAPIs(sds.APIs()) @@ -843,9 +845,6 @@ func (sds *Service) writeStateDiffWithRetry(block *types.Block, parentRoot commo func (sds *Service) SubscribeWriteStatus(id rpc.ID, sub chan<- JobStatus, quitChan chan<- bool) { log.Info("Subscribing to job status updates", "subscription id", id) sds.Lock() - if sds.jobStatusSubs == nil { - sds.jobStatusSubs = map[rpc.ID]statusSubscription{} - } sds.jobStatusSubs[id] = statusSubscription{ statusChan: sub, quitChan: quitChan,