From 0d21da4a010d421def7ca28f31ba6b70d516e62b Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Wed, 3 Aug 2022 14:43:47 +0700 Subject: [PATCH] erigon22: auto create dir (#4911) --- cmd/state/commands/erigon22.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/state/commands/erigon22.go b/cmd/state/commands/erigon22.go index cd13be2d6..2e5f2574f 100644 --- a/cmd/state/commands/erigon22.go +++ b/cmd/state/commands/erigon22.go @@ -17,6 +17,7 @@ import ( "time" libcommon "github.com/ledgerwatch/erigon-lib/common" + "github.com/ledgerwatch/erigon-lib/common/dir" "github.com/ledgerwatch/erigon-lib/kv" kv2 "github.com/ledgerwatch/erigon-lib/kv/mdbx" libstate "github.com/ledgerwatch/erigon-lib/state" @@ -312,6 +313,7 @@ func Erigon22(genesis *core.Genesis, logger log.Logger) error { return err } } + dir.MustExist(reconDbPath) limiter := semaphore.NewWeighted(int64(runtime.NumCPU() + 1)) db, err := kv2.NewMDBX(logger).Path(reconDbPath).RoTxsLimiter(limiter).Open() if err != nil { @@ -401,10 +403,8 @@ func Erigon22(genesis *core.Genesis, logger log.Logger) error { } else if err = os.RemoveAll(aggDir); err != nil { return err } - if err = os.MkdirAll(aggDir, 0755); err != nil { - return err - } } + dir.MustExist(reconDbPath) agg, err := libstate.NewAggregator22(aggDir, AggregationStep) if err != nil { return err