From 89f8a4350921822305a3da3c6ceac8e4adf1cef8 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Tue, 10 Jan 2023 09:57:52 +0700 Subject: [PATCH] parallel warmup to exit early if nil --- eth/stagedsync/stage_hashstate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eth/stagedsync/stage_hashstate.go b/eth/stagedsync/stage_hashstate.go index 44cace509..52b01b358 100644 --- a/eth/stagedsync/stage_hashstate.go +++ b/eth/stagedsync/stage_hashstate.go @@ -307,6 +307,9 @@ func parallelTransform(ctx context.Context, in chan pair, out chan pair, transfo } func parallelWarmup(ctx context.Context, db kv.RoDB, bucket string, workers int) error { + if db == nil || ctx == nil || workers == 0 { + return nil + } g, ctx := errgroup.WithContext(ctx) g.SetLimit(workers) for i := 0; i < 256; i++ {