diff options
-rw-r--r-- | cmd/utils/flags.go | 7 | ||||
-rw-r--r-- | params/util.go | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 2d6bb4f5b..f86fc37f5 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -881,6 +881,13 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon config.EIP158Block = params.MainNetSpuriousDragon } } + if config.ChainId.BitLen() == 0 { + if ctx.GlobalBool(TestNetFlag.Name) { + config.ChainId = params.TestNetChainID + } else { + config.ChainId = params.MainNetChainID + } + } config.DAOForkSupport = true } diff --git a/params/util.go b/params/util.go index 377f4ce7c..b96f33da2 100644 --- a/params/util.go +++ b/params/util.go @@ -37,4 +37,7 @@ var ( TestNetSpuriousDragon = big.NewInt(3000000) MainNetSpuriousDragon = big.NewInt(3000000) + + TestNetChainID = big.NewInt(2) // Test net default chain ID + MainNetChainID = big.NewInt(1) // main net default chain ID ) |