|
|
|
@ -21,7 +21,6 @@ import ( |
|
|
|
|
"crypto/ecdsa" |
|
|
|
|
"fmt" |
|
|
|
|
"io/ioutil" |
|
|
|
|
"math" |
|
|
|
|
"math/big" |
|
|
|
|
"os" |
|
|
|
|
"path/filepath" |
|
|
|
@ -116,13 +115,9 @@ var ( |
|
|
|
|
} |
|
|
|
|
NetworkIdFlag = cli.IntFlag{ |
|
|
|
|
Name: "networkid", |
|
|
|
|
Usage: "Network identifier (integer, 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten)", |
|
|
|
|
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten)", |
|
|
|
|
Value: eth.NetworkId, |
|
|
|
|
} |
|
|
|
|
OlympicFlag = cli.BoolFlag{ |
|
|
|
|
Name: "olympic", |
|
|
|
|
Usage: "Olympic network: pre-configured pre-release test network", |
|
|
|
|
} |
|
|
|
|
TestNetFlag = cli.BoolFlag{ |
|
|
|
|
Name: "testnet", |
|
|
|
|
Usage: "Ropsten network: pre-configured test network", |
|
|
|
@ -712,7 +707,7 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node { |
|
|
|
|
// given node.
|
|
|
|
|
func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) { |
|
|
|
|
// Avoid conflicting network flags
|
|
|
|
|
networks, netFlags := 0, []cli.BoolFlag{DevModeFlag, TestNetFlag, OlympicFlag} |
|
|
|
|
networks, netFlags := 0, []cli.BoolFlag{DevModeFlag, TestNetFlag} |
|
|
|
|
for _, flag := range netFlags { |
|
|
|
|
if ctx.GlobalBool(flag.Name) { |
|
|
|
|
networks++ |
|
|
|
@ -750,12 +745,6 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) { |
|
|
|
|
|
|
|
|
|
// Override any default configs in dev mode or the test net
|
|
|
|
|
switch { |
|
|
|
|
case ctx.GlobalBool(OlympicFlag.Name): |
|
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) { |
|
|
|
|
ethConf.NetworkId = 1 |
|
|
|
|
} |
|
|
|
|
ethConf.Genesis = core.OlympicGenesisBlock() |
|
|
|
|
|
|
|
|
|
case ctx.GlobalBool(TestNetFlag.Name): |
|
|
|
|
if !ctx.GlobalIsSet(NetworkIdFlag.Name) { |
|
|
|
|
ethConf.NetworkId = 3 |
|
|
|
@ -763,7 +752,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) { |
|
|
|
|
ethConf.Genesis = core.DefaultTestnetGenesisBlock() |
|
|
|
|
|
|
|
|
|
case ctx.GlobalBool(DevModeFlag.Name): |
|
|
|
|
ethConf.Genesis = core.OlympicGenesisBlock() |
|
|
|
|
ethConf.Genesis = core.DevGenesisBlock() |
|
|
|
|
if !ctx.GlobalIsSet(GasPriceFlag.Name) { |
|
|
|
|
ethConf.GasPrice = new(big.Int) |
|
|
|
|
} |
|
|
|
@ -820,16 +809,6 @@ func RegisterEthStatsService(stack *node.Node, url string) { |
|
|
|
|
|
|
|
|
|
// SetupNetwork configures the system for either the main net or some test network.
|
|
|
|
|
func SetupNetwork(ctx *cli.Context) { |
|
|
|
|
switch { |
|
|
|
|
case ctx.GlobalBool(OlympicFlag.Name): |
|
|
|
|
params.DurationLimit = big.NewInt(8) |
|
|
|
|
params.GenesisGasLimit = big.NewInt(3141592) |
|
|
|
|
params.MinGasLimit = big.NewInt(125000) |
|
|
|
|
params.MaximumExtraDataSize = big.NewInt(1024) |
|
|
|
|
NetworkIdFlag.Value = 0 |
|
|
|
|
core.BlockReward = big.NewInt(1.5e+18) |
|
|
|
|
core.ExpDiffPeriod = big.NewInt(math.MaxInt64) |
|
|
|
|
} |
|
|
|
|
params.TargetGasLimit = common.String2Big(ctx.GlobalString(TargetGasLimitFlag.Name)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -920,13 +899,6 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai |
|
|
|
|
var err error |
|
|
|
|
chainDb = MakeChainDatabase(ctx, stack) |
|
|
|
|
|
|
|
|
|
if ctx.GlobalBool(OlympicFlag.Name) { |
|
|
|
|
_, err := core.WriteOlympicGenesisBlock(chainDb) |
|
|
|
|
if err != nil { |
|
|
|
|
glog.Fatalln(err) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ctx.GlobalBool(TestNetFlag.Name) { |
|
|
|
|
_, err := core.WriteTestNetGenesisBlock(chainDb) |
|
|
|
|
if err != nil { |
|
|
|
|