mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
cmd/utils: add network flags for worldland mainnet and testnet
This commit is contained in:
parent
b1853568f5
commit
87a1904e6f
1 changed files with 89 additions and 16 deletions
|
|
@ -122,7 +122,7 @@ var (
|
|||
Value: ethconfig.Defaults.NetworkId,
|
||||
Category: flags.EthCategory,
|
||||
}
|
||||
MainnetFlag = &cli.BoolFlag{
|
||||
/*MainnetFlag = &cli.BoolFlag{
|
||||
Name: "mainnet",
|
||||
Usage: "Ethereum mainnet",
|
||||
Category: flags.EthCategory,
|
||||
|
|
@ -151,6 +151,20 @@ var (
|
|||
Name: "kiln",
|
||||
Usage: "Kiln network: pre-configured proof-of-work to proof-of-stake test network",
|
||||
Category: flags.EthCategory,
|
||||
}*/
|
||||
// EccPoW settings
|
||||
LveFlag = &cli.BoolFlag{
|
||||
Name: "lve",
|
||||
Usage: "LVE Network: Error-Correction Codes Proof-of-Work Main Network",
|
||||
}
|
||||
// Worldland settings
|
||||
SeoulFlag = &cli.BoolFlag{
|
||||
Name: "seoul",
|
||||
Usage: "Seoul Network: Error-Correction Codes Proof-of-Work Main Network",
|
||||
}
|
||||
GwangjuFlag = &cli.BoolFlag{
|
||||
Name: "gwangju",
|
||||
Usage: "Gwangju network: Error-Correction Codes Proof-of-Work Test Network",
|
||||
}
|
||||
|
||||
// Dev mode
|
||||
|
|
@ -981,15 +995,18 @@ var (
|
|||
var (
|
||||
// TestnetFlags is the flag group of all built-in supported testnets.
|
||||
TestnetFlags = []cli.Flag{
|
||||
RopstenFlag,
|
||||
/*RopstenFlag,
|
||||
RinkebyFlag,
|
||||
GoerliFlag,
|
||||
SepoliaFlag,
|
||||
KilnFlag,
|
||||
KilnFlag,*/
|
||||
GwangjuFlag,
|
||||
}
|
||||
// NetworkFlags is the flag group of all built-in supported networks.
|
||||
NetworkFlags = append([]cli.Flag{
|
||||
MainnetFlag,
|
||||
//MainnetFlag,
|
||||
LveFlag,
|
||||
SeoulFlag,
|
||||
}, TestnetFlags...)
|
||||
|
||||
// DatabasePathFlags is the flag group of all database path flags.
|
||||
|
|
@ -1005,7 +1022,7 @@ var (
|
|||
// then a subdirectory of the specified datadir will be used.
|
||||
func MakeDataDir(ctx *cli.Context) string {
|
||||
if path := ctx.String(DataDirFlag.Name); path != "" {
|
||||
if ctx.Bool(RopstenFlag.Name) {
|
||||
/*if ctx.Bool(RopstenFlag.Name) {
|
||||
// Maintain compatibility with older Geth configurations storing the
|
||||
// Ropsten database in `testnet` instead of `ropsten`.
|
||||
return filepath.Join(path, "ropsten")
|
||||
|
|
@ -1021,6 +1038,15 @@ func MakeDataDir(ctx *cli.Context) string {
|
|||
}
|
||||
if ctx.Bool(KilnFlag.Name) {
|
||||
return filepath.Join(path, "kiln")
|
||||
}*/
|
||||
if ctx.Bool(LveFlag.Name) {
|
||||
return filepath.Join(path, "lve")
|
||||
}
|
||||
if ctx.Bool(SeoulFlag.Name) {
|
||||
return filepath.Join(path, "seoul")
|
||||
}
|
||||
if ctx.Bool(GwangjuFlag.Name) {
|
||||
return filepath.Join(path, "gwangju")
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
@ -1068,7 +1094,7 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
|||
switch {
|
||||
case ctx.IsSet(BootnodesFlag.Name):
|
||||
urls = SplitAndTrim(ctx.String(BootnodesFlag.Name))
|
||||
case ctx.Bool(RopstenFlag.Name):
|
||||
/*case ctx.Bool(RopstenFlag.Name):
|
||||
urls = params.RopstenBootnodes
|
||||
case ctx.Bool(SepoliaFlag.Name):
|
||||
urls = params.SepoliaBootnodes
|
||||
|
|
@ -1077,9 +1103,14 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
|||
case ctx.Bool(GoerliFlag.Name):
|
||||
urls = params.GoerliBootnodes
|
||||
case ctx.Bool(KilnFlag.Name):
|
||||
urls = params.KilnBootnodes
|
||||
urls = params.KilnBootnodes*/
|
||||
case ctx.Bool(LveFlag.Name):
|
||||
urls = params.LveBootnodes
|
||||
case ctx.Bool(SeoulFlag.Name):
|
||||
urls = params.SeoulBootnodes
|
||||
case ctx.Bool(GwangjuFlag.Name):
|
||||
urls = params.GwangjuBootnodes
|
||||
}
|
||||
|
||||
// don't apply defaults if BootstrapNodes is already set
|
||||
if cfg.BootstrapNodes != nil {
|
||||
return
|
||||
|
|
@ -1516,7 +1547,7 @@ func SetDataDir(ctx *cli.Context, cfg *node.Config) {
|
|||
cfg.DataDir = ctx.String(DataDirFlag.Name)
|
||||
case ctx.Bool(DeveloperFlag.Name):
|
||||
cfg.DataDir = "" // unless explicitly requested, use memory databases
|
||||
case ctx.Bool(RopstenFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
/*case ctx.Bool(RopstenFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
// Maintain compatibility with older Geth configurations storing the
|
||||
// Ropsten database in `testnet` instead of `ropsten`.
|
||||
legacyPath := filepath.Join(node.DefaultDataDir(), "testnet")
|
||||
|
|
@ -1535,7 +1566,13 @@ func SetDataDir(ctx *cli.Context, cfg *node.Config) {
|
|||
case ctx.Bool(SepoliaFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "sepolia")
|
||||
case ctx.Bool(KilnFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "kiln")
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "kiln")*/
|
||||
case ctx.Bool(LveFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "lve")
|
||||
case ctx.Bool(SeoulFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "seoul")
|
||||
case ctx.Bool(GwangjuFlag.Name) && cfg.DataDir == node.DefaultDataDir():
|
||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "gwangju")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1726,7 +1763,8 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
|
|||
// SetEthConfig applies eth-related command line flags to the config.
|
||||
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||
// Avoid conflicting network flags
|
||||
CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, KilnFlag)
|
||||
//CheckExclusive(ctx, MainnetFlag, DeveloperFlag, RopstenFlag, RinkebyFlag, GoerliFlag, SepoliaFlag, KilnFlag, LveFlag, SeoulFlag, GwangjuFlag)
|
||||
CheckExclusive(ctx, DeveloperFlag, LveFlag, SeoulFlag, GwangjuFlag)
|
||||
CheckExclusive(ctx, LightServeFlag, SyncModeFlag, "light")
|
||||
CheckExclusive(ctx, DeveloperFlag, ExternalSignerFlag) // Can't use both ephemeral unlocked and external signer
|
||||
if ctx.String(GCModeFlag.Name) == "archive" && ctx.Uint64(TxLookupLimitFlag.Name) != 0 {
|
||||
|
|
@ -1861,7 +1899,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
}
|
||||
// Override any default configs for hard coded networks.
|
||||
switch {
|
||||
case ctx.Bool(MainnetFlag.Name):
|
||||
/*case ctx.Bool(MainnetFlag.Name):
|
||||
if !ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 1
|
||||
}
|
||||
|
|
@ -1906,7 +1944,25 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
|||
cfg.NetworkId = 1337802
|
||||
}
|
||||
cfg.Genesis = core.DefaultKilnGenesisBlock()
|
||||
SetDNSDiscoveryDefaults(cfg, params.KilnGenesisHash)
|
||||
SetDNSDiscoveryDefaults(cfg, params.KilnGenesisHash)*/
|
||||
case ctx.Bool(LveFlag.Name):
|
||||
if !ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 12345
|
||||
}
|
||||
cfg.Genesis = core.DefaultLveGenesisBlock()
|
||||
SetDNSDiscoveryDefaults(cfg, params.LveGenesisHash)
|
||||
case ctx.Bool(SeoulFlag.Name):
|
||||
if !ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 103
|
||||
}
|
||||
cfg.Genesis = core.DefaultSeoulGenesisBlock()
|
||||
SetDNSDiscoveryDefaults(cfg, params.SeoulGenesisHash)
|
||||
case ctx.Bool(GwangjuFlag.Name):
|
||||
if !ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 10395
|
||||
}
|
||||
cfg.Genesis = core.DefaultGwangjuGenesisBlock()
|
||||
SetDNSDiscoveryDefaults(cfg, params.GwangjuGenesisHash)
|
||||
case ctx.Bool(DeveloperFlag.Name):
|
||||
if !ctx.IsSet(NetworkIdFlag.Name) {
|
||||
cfg.NetworkId = 1337
|
||||
|
|
@ -2146,7 +2202,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.
|
|||
func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
||||
var genesis *core.Genesis
|
||||
switch {
|
||||
case ctx.Bool(MainnetFlag.Name):
|
||||
/*case ctx.Bool(MainnetFlag.Name):
|
||||
genesis = core.DefaultGenesisBlock()
|
||||
case ctx.Bool(RopstenFlag.Name):
|
||||
genesis = core.DefaultRopstenGenesisBlock()
|
||||
|
|
@ -2157,7 +2213,13 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
|||
case ctx.Bool(GoerliFlag.Name):
|
||||
genesis = core.DefaultGoerliGenesisBlock()
|
||||
case ctx.Bool(KilnFlag.Name):
|
||||
genesis = core.DefaultKilnGenesisBlock()
|
||||
genesis = core.DefaultKilnGenesisBlock()*/
|
||||
case ctx.Bool(LveFlag.Name):
|
||||
genesis = core.DefaultLveGenesisBlock()
|
||||
case ctx.Bool(SeoulFlag.Name):
|
||||
genesis = core.DefaultSeoulGenesisBlock()
|
||||
case ctx.Bool(GwangjuFlag.Name):
|
||||
genesis = core.DefaultGwangjuGenesisBlock()
|
||||
case ctx.Bool(DeveloperFlag.Name):
|
||||
Fatalf("Developer chains are ephemeral")
|
||||
}
|
||||
|
|
@ -2174,11 +2236,22 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (*core.BlockChain, ethdb.Data
|
|||
if err != nil {
|
||||
Fatalf("%v", err)
|
||||
}
|
||||
/*eccpowConfig, err := core.LoadEccpowConfig(chainDb, gspec)
|
||||
if err != nil {
|
||||
Fatalf("%v", err)
|
||||
}*/
|
||||
|
||||
ethashConfig := ethconfig.Defaults.Ethash
|
||||
if ctx.Bool(FakePoWFlag.Name) {
|
||||
ethashConfig.PowMode = ethash.ModeFake
|
||||
}
|
||||
engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, nil, false, chainDb)
|
||||
|
||||
eccpowConfig := ethconfig.Defaults.Eccpow
|
||||
if ctx.Bool(FakePoWFlag.Name) {
|
||||
ethashConfig.PowMode = ethash.ModeFake
|
||||
}
|
||||
|
||||
engine := ethconfig.CreateConsensusEngine(stack, ðashConfig, cliqueConfig, &eccpowConfig, nil, false, chainDb)
|
||||
if gcmode := ctx.String(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" {
|
||||
Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue