cmd/geth: set correct initial nonce on testnet for import/init subcommands (#2924)
This commit is contained in:
parent
7d9c5e0f7d
commit
6bd9008025
@ -76,6 +76,9 @@ func importChain(ctx *cli.Context) error {
|
|||||||
if len(ctx.Args()) != 1 {
|
if len(ctx.Args()) != 1 {
|
||||||
utils.Fatalf("This command requires an argument.")
|
utils.Fatalf("This command requires an argument.")
|
||||||
}
|
}
|
||||||
|
if ctx.GlobalBool(utils.TestNetFlag.Name) {
|
||||||
|
state.StartingNonce = 1048576 // (2**20)
|
||||||
|
}
|
||||||
chain, chainDb := utils.MakeChain(ctx)
|
chain, chainDb := utils.MakeChain(ctx)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
err := utils.ImportChain(chain, ctx.Args().First())
|
err := utils.ImportChain(chain, ctx.Args().First())
|
||||||
|
@ -33,6 +33,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/console"
|
"github.com/ethereum/go-ethereum/console"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/eth"
|
"github.com/ethereum/go-ethereum/eth"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/internal/debug"
|
"github.com/ethereum/go-ethereum/internal/debug"
|
||||||
@ -266,6 +267,10 @@ func initGenesis(ctx *cli.Context) error {
|
|||||||
utils.Fatalf("must supply path to genesis JSON file")
|
utils.Fatalf("must supply path to genesis JSON file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.GlobalBool(utils.TestNetFlag.Name) {
|
||||||
|
state.StartingNonce = 1048576 // (2**20)
|
||||||
|
}
|
||||||
|
|
||||||
chainDb, err := ethdb.NewLDBDatabase(filepath.Join(utils.MustMakeDataDir(ctx), "chaindata"), 0, 0)
|
chainDb, err := ethdb.NewLDBDatabase(filepath.Join(utils.MustMakeDataDir(ctx), "chaindata"), 0, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatalf("could not open database: %v", err)
|
utils.Fatalf("could not open database: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user