Init Ethereum Classic flags and chain config

This commit is contained in:
Ellaismer 2018-04-02 04:50:08 -04:00
parent 7416d388f4
commit 9c89633205
7 changed files with 54 additions and 1 deletions

View file

@ -136,6 +136,7 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
utils.FakePoWFlag,
utils.TestnetFlag,
utils.EllaismFlag,
utils.ClassicFlag,
utils.RinkebyFlag,
},
Category: "BLOCKCHAIN COMMANDS",

View file

@ -128,6 +128,8 @@ func remoteConsole(ctx *cli.Context) error {
path = filepath.Join(path, "rinkeby")
} else if ctx.GlobalBool(utils.EllaismFlag.Name) {
path = filepath.Join(path, "ellaism")
} else if ctx.GlobalBool(utils.ClassicFlag.Name) {
path = filepath.Join(path, "classic")
}
}
endpoint = fmt.Sprintf("%s/geth.ipc", path)

View file

@ -110,6 +110,7 @@ var (
utils.DeveloperPeriodFlag,
utils.TestnetFlag,
utils.EllaismFlag,
utils.ClassicFlag,
utils.RinkebyFlag,
utils.VMEnableDebugFlag,
utils.NetworkIdFlag,

View file

@ -74,6 +74,7 @@ var AppHelpFlagGroups = []flagGroup{
utils.NetworkIdFlag,
utils.TestnetFlag,
utils.EllaismFlag,
utils.ClassicFlag,
utils.RinkebyFlag,
utils.SyncModeFlag,
utils.GCModeFlag,

View file

@ -139,6 +139,10 @@ var (
Name: "ellaism",
Usage: "Ellaism network: pre-configured Ellaism mainnet",
}
ClassicFlag = cli.BoolFlag{
Name: "classic",
Usage: "Ethereum Classic network: pre-configured Ethereum Classic mainnet",
}
RinkebyFlag = cli.BoolFlag{
Name: "rinkeby",
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
@ -549,6 +553,9 @@ func MakeDataDir(ctx *cli.Context) string {
if ctx.GlobalBool(EllaismFlag.Name) {
return filepath.Join(path, "ellaism")
}
if ctx.GlobalBool(ClassicFlag.Name) {
return filepath.Join(path, "classic")
}
if ctx.GlobalBool(RinkebyFlag.Name) {
return filepath.Join(path, "rinkeby")
}
@ -606,6 +613,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls = params.TestnetBootnodes
case ctx.GlobalBool(EllaismFlag.Name):
urls = params.EllaismBootnodes
case ctx.GlobalBool(ClassicFlag.Name):
urls = params.ClassicBootnodes
case ctx.GlobalBool(RinkebyFlag.Name):
urls = params.RinkebyBootnodes
case cfg.BootstrapNodes != nil:
@ -894,6 +903,8 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
case ctx.GlobalBool(EllaismFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ellaism")
case ctx.GlobalBool(ClassicFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "classic")
case ctx.GlobalBool(RinkebyFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
}
@ -1023,7 +1034,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
// SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
// Avoid conflicting network flags
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, EllaismFlag)
checkExclusive(ctx, DeveloperFlag, TestnetFlag, RinkebyFlag, EllaismFlag, ClassicFlag)
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
checkExclusive(ctx, LightServFlag, LightModeFlag)
checkExclusive(ctx, LightServFlag, SyncModeFlag, "light")
@ -1094,6 +1105,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
cfg.NetworkId = 64
}
cfg.Genesis = core.DefaultEllaismGenesisBlock()
case ctx.GlobalBool(ClassicFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 1
}
cfg.Genesis = core.DefaultClassicGenesisBlock()
case ctx.GlobalBool(RinkebyFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 4
@ -1221,6 +1237,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
genesis = core.DefaultTestnetGenesisBlock()
case ctx.GlobalBool(EllaismFlag.Name):
genesis = core.DefaultEllaismGenesisBlock()
case ctx.GlobalBool(ClassicFlag.Name):
genesis = core.DefaultClassicGenesisBlock()
case ctx.GlobalBool(RinkebyFlag.Name):
genesis = core.DefaultRinkebyGenesisBlock()
case ctx.GlobalBool(DeveloperFlag.Name):

View file

@ -334,6 +334,18 @@ func DefaultEllaismGenesisBlock() *Genesis {
}
}
// ClassicGenesisBlock returns the Ellaism genesis block.
func DefaultClassicGenesisBlock() *Genesis {
return &Genesis{
Config: params.ClassicChainConfig,
Nonce: 66,
ExtraData: hexutil.MustDecode("0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"),
GasLimit: 5000,
Difficulty: big.NewInt(17179869184),
Alloc: decodePrealloc(mainnetAllocData),
}
}
// DefaultTestnetGenesisBlock returns the Ropsten network genesis block.
func DefaultTestnetGenesisBlock() *Genesis {
return &Genesis{

View file

@ -64,6 +64,24 @@ var (
Ethash: new(EthashConfig),
}
// ClassicChainConfig is the chain parameters to run a node on the Ellaism main network.
ClassicChainConfig = &ChainConfig{
ChainId: big.NewInt(61),
HomesteadBlock: big.NewInt(1150000),
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: big.NewInt(2500000),
EIP150Hash: common.HexToHash("0xca12c63534f565899681965528d536c52cb05b7c48e269c2a6cb77ad864d878a"),
EIP155Block: big.NewInt(3000000),
EIP158Block: nil,
ByzantiumBlock: nil,
DisposalBlock: big.NewInt(5900000),
ConstantinopleBlock: nil,
ECIP1017EraRounds: big.NewInt(5000000),
EIP160Block: big.NewInt(3000000),
Ethash: new(EthashConfig),
}
// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
TestnetChainConfig = &ChainConfig{
ChainId: big.NewInt(3),