diff --git a/cmd/cortex/chaincmd.go b/cmd/cortex/chaincmd.go index 65e3bc8ddb..73c2a24fb4 100644 --- a/cmd/cortex/chaincmd.go +++ b/cmd/cortex/chaincmd.go @@ -337,7 +337,8 @@ func exportChain(ctx *cli.Context) error { utils.Fatalf("This command requires an argument.") } stack := makeFullNode(ctx) - chain, _ := utils.MakeChain(ctx, stack, true) + chain, db := utils.MakeChain(ctx, stack, true) + defer db.Close() start := time.Now() var err error @@ -371,6 +372,7 @@ func importPreimages(ctx *cli.Context) error { } stack := makeFullNode(ctx) diskdb := utils.MakeChainDatabase(ctx, stack, false).(ctxcdb.Database) + defer diskdb.Close() start := time.Now() if err := utils.ImportPreimages(diskdb, ctx.Args().First()); err != nil { @@ -387,6 +389,7 @@ func exportPreimages(ctx *cli.Context) error { } stack := makeFullNode(ctx) diskdb := utils.MakeChainDatabase(ctx, stack, false).(ctxcdb.Database) + defer diskdb.Close() start := time.Now() if err := utils.ExportPreimages(diskdb, ctx.Args().First()); err != nil { diff --git a/cmd/cortex/verkle.go b/cmd/cortex/verkle.go index bf72bde2cb..5c82d00e35 100644 --- a/cmd/cortex/verkle.go +++ b/cmd/cortex/verkle.go @@ -120,6 +120,7 @@ func verifyVerkle(ctx *cli.Context) error { defer stack.Close() chaindb := utils.MakeChainDatabase(ctx, stack, true) + defer chaindb.Close() headBlock := rawdb.ReadHeadBlock(chaindb) if headBlock == nil { log.Error("Failed to load head block") @@ -168,6 +169,7 @@ func expandVerkle(ctx *cli.Context) error { defer stack.Close() chaindb := utils.MakeChainDatabase(ctx, stack, true) + defer chaindb.Close() var ( rootC common.Hash keylist [][]byte