mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
cmd, core: merge flags testnet and apothem
This commit is contained in:
parent
020e9aa81d
commit
1d653e57ab
5 changed files with 14 additions and 27 deletions
|
|
@ -45,7 +45,7 @@ var (
|
|||
utils.DataDirFlag,
|
||||
utils.XDCXDataDirFlag,
|
||||
utils.LightModeFlag,
|
||||
utils.XDCTestnetFlag,
|
||||
utils.TestnetFlag,
|
||||
},
|
||||
Description: `
|
||||
The init command initializes a new genesis block and definition for the network.
|
||||
|
|
@ -156,9 +156,9 @@ Use "ethereum dump 0" to dump the genesis block.`,
|
|||
func initGenesis(ctx *cli.Context) error {
|
||||
var err error
|
||||
genesis := new(core.Genesis)
|
||||
if ctx.Bool(utils.XDCTestnetFlag.Name) {
|
||||
if ctx.Bool(utils.TestnetFlag.Name) {
|
||||
if ctx.Args().Len() > 0 {
|
||||
utils.Fatalf("Flags --apothem and genesis file can't be used at the same time")
|
||||
utils.Fatalf("The testnet flag and genesis file can't be used at the same time")
|
||||
}
|
||||
err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis)
|
||||
} else {
|
||||
|
|
@ -168,7 +168,7 @@ func initGenesis(ctx *cli.Context) error {
|
|||
genesisPath := ctx.Args().First()
|
||||
if genesisPath == "mainnet" {
|
||||
err = json.Unmarshal(xdc_genesis.MainnetGenesis, &genesis)
|
||||
} else if genesisPath == "testnet" {
|
||||
} else if genesisPath == "testnet" || genesisPath == "apothem" {
|
||||
err = json.Unmarshal(xdc_genesis.TestnetGenesis, &genesis)
|
||||
} else if genesisPath == "devnet" {
|
||||
err = json.Unmarshal(xdc_genesis.DevnetGenesis, &genesis)
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
|
|||
}
|
||||
|
||||
// Check testnet is enable.
|
||||
if ctx.Bool(utils.XDCTestnetFlag.Name) {
|
||||
if ctx.Bool(utils.TestnetFlag.Name) {
|
||||
common.IsTestnet = true
|
||||
common.TRC21IssuerSMC = common.TRC21IssuerSMCTestNet
|
||||
cfg.Eth.NetworkId = 51
|
||||
|
|
|
|||
|
|
@ -117,10 +117,9 @@ var (
|
|||
utils.NodeKeyHexFlag,
|
||||
//utils.DeveloperFlag,
|
||||
//utils.DeveloperPeriodFlag,
|
||||
//utils.TestnetFlag,
|
||||
utils.TestnetFlag,
|
||||
//utils.RinkebyFlag,
|
||||
//utils.VMEnableDebugFlag,
|
||||
utils.XDCTestnetFlag,
|
||||
utils.Enable0xPrefixFlag,
|
||||
utils.EnableXDCPrefixFlag,
|
||||
utils.RewoundFlag,
|
||||
|
|
|
|||
|
|
@ -106,12 +106,8 @@ var (
|
|||
}
|
||||
TestnetFlag = &cli.BoolFlag{
|
||||
Name: "testnet",
|
||||
Usage: "Ropsten network: pre-configured proof-of-work test network",
|
||||
Category: flags.EthCategory,
|
||||
}
|
||||
XDCTestnetFlag = &cli.BoolFlag{
|
||||
Name: "apothem",
|
||||
Usage: "XDC Apothem Network",
|
||||
Aliases: []string{"apothem"},
|
||||
Usage: "XDC apothem network",
|
||||
Category: flags.EthCategory,
|
||||
}
|
||||
RinkebyFlag = &cli.BoolFlag{
|
||||
|
|
@ -883,14 +879,11 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
|||
if cfg.BootstrapNodes != nil {
|
||||
return // Already set by config file, don't apply defaults.
|
||||
}
|
||||
networkID := uint64(0)
|
||||
if ctx.IsSet(NetworkIdFlag.Name) {
|
||||
networkID = ctx.Uint64(NetworkIdFlag.Name)
|
||||
}
|
||||
networkID := ctx.Uint64(NetworkIdFlag.Name)
|
||||
switch {
|
||||
case ctx.Bool(XDCTestnetFlag.Name) || networkID == params.TestnetChainConfig.ChainId.Uint64():
|
||||
case ctx.Bool(TestnetFlag.Name) || networkID == 51:
|
||||
urls = params.TestnetBootnodes
|
||||
case networkID == params.DevnetChainConfig.ChainId.Uint64():
|
||||
case networkID == 551:
|
||||
urls = params.DevnetBootnodes
|
||||
}
|
||||
}
|
||||
|
|
@ -921,7 +914,7 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
|
|||
urls = SplitAndTrim(ctx.String(BootnodesFlag.Name))
|
||||
case ctx.IsSet(BootnodesV5Flag.Name):
|
||||
urls = SplitAndTrim(ctx.String(BootnodesV5Flag.Name))
|
||||
case ctx.Bool(XDCTestnetFlag.Name):
|
||||
case ctx.Bool(TestnetFlag.Name):
|
||||
urls = params.TestnetBootnodes
|
||||
case cfg.BootstrapNodesV5 != nil:
|
||||
return // already set, don't apply defaults.
|
||||
|
|
@ -1443,9 +1436,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
if ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name)
|
||||
}
|
||||
if ctx.Bool(XDCTestnetFlag.Name) {
|
||||
cfg.NetworkId = 51
|
||||
}
|
||||
|
||||
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) {
|
||||
cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100
|
||||
|
|
@ -1501,7 +1491,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
switch {
|
||||
case ctx.Bool(TestnetFlag.Name):
|
||||
if !ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 3
|
||||
cfg.NetworkId = 51
|
||||
}
|
||||
cfg.Genesis = core.DefaultTestnetGenesisBlock()
|
||||
case ctx.Bool(RinkebyFlag.Name):
|
||||
|
|
|
|||
|
|
@ -281,10 +281,8 @@ func DefaultGenesisBlock() *Genesis {
|
|||
}
|
||||
}
|
||||
|
||||
// DefaultTestnetGenesisBlock returns the Ropsten network genesis block.
|
||||
// DefaultTestnetGenesisBlock returns the XDC testnet genesis block.
|
||||
func DefaultTestnetGenesisBlock() *Genesis {
|
||||
config := params.TestnetChainConfig
|
||||
config.XDPoS.V2 = nil
|
||||
return &Genesis{
|
||||
Config: params.TestnetChainConfig,
|
||||
Nonce: 0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue