Skip to content

Commit

Permalink
cmd/geth: fix importBlock (#2244)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann authored Apr 15, 2024
1 parent b4fb2f6 commit 837de88
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/internal/era"
"github.com/ethereum/go-ethereum/internal/flags"
Expand Down Expand Up @@ -500,10 +501,16 @@ func importChain(ctx *cli.Context) error {
// Start system runtime metrics collection
go metrics.CollectProcessMetrics(3 * time.Second)

stack, _ := makeConfigNode(ctx)
stack, cfg := makeConfigNode(ctx)
defer stack.Close()

chain, db := utils.MakeChain(ctx, stack, false)
backend, err := eth.New(stack, &cfg.Eth)
if err != nil {
return err
}

chain := backend.BlockChain()
db := backend.ChainDb()
defer db.Close()

// Start periodically gathering memory profiles
Expand Down

0 comments on commit 837de88

Please sign in to comment.