diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-26 13:54:28 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2018-12-19 20:54:27 +0800 |
commit | 18c57d4af12b9a532897459d8ad11579436b9bab (patch) | |
tree | c3f440ef44e1ea1da23783ef94fd05ba0cff9c4b /cmd | |
parent | ce9dd85433e342b9ee13848414bc694921be1100 (diff) | |
download | dexon-18c57d4af12b9a532897459d8ad11579436b9bab.tar.gz dexon-18c57d4af12b9a532897459d8ad11579436b9bab.tar.zst dexon-18c57d4af12b9a532897459d8ad11579436b9bab.zip |
core: add Taipei testnet (#47)
Add a new testnet named Taipei.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gdex/consolecmd.go | 2 | ||||
-rw-r--r-- | cmd/gdex/main.go | 1 | ||||
-rw-r--r-- | cmd/gdex/usage.go | 3 | ||||
-rw-r--r-- | cmd/utils/flags.go | 28 |
4 files changed, 29 insertions, 5 deletions
diff --git a/cmd/gdex/consolecmd.go b/cmd/gdex/consolecmd.go index 9915e1ee0..8b9d58dad 100644 --- a/cmd/gdex/consolecmd.go +++ b/cmd/gdex/consolecmd.go @@ -124,6 +124,8 @@ func remoteConsole(ctx *cli.Context) error { if path != "" { if ctx.GlobalBool(utils.TestnetFlag.Name) { path = filepath.Join(path, "testnet") + } else if ctx.GlobalBool(utils.TaipeiFlag.Name) { + path = filepath.Join(path, "taipei") } } endpoint = fmt.Sprintf("%s/gdex.ipc", path) diff --git a/cmd/gdex/main.go b/cmd/gdex/main.go index dd08bb353..c4a7956e4 100644 --- a/cmd/gdex/main.go +++ b/cmd/gdex/main.go @@ -122,6 +122,7 @@ var ( utils.DeveloperFlag, utils.DeveloperPeriodFlag, utils.TestnetFlag, + utils.TaipeiFlag, utils.VMEnableDebugFlag, utils.NetworkIdFlag, utils.ConstantinopleOverrideFlag, diff --git a/cmd/gdex/usage.go b/cmd/gdex/usage.go index 9b930e081..e657e032b 100644 --- a/cmd/gdex/usage.go +++ b/cmd/gdex/usage.go @@ -65,7 +65,7 @@ type flagGroup struct { // AppHelpFlagGroups is the application flags, grouped by functionality. var AppHelpFlagGroups = []flagGroup{ { - Name: "ETHEREUM", + Name: "DEXON", Flags: []cli.Flag{ configFileFlag, utils.DataDirFlag, @@ -73,6 +73,7 @@ var AppHelpFlagGroups = []flagGroup{ utils.NoUSBFlag, utils.NetworkIdFlag, utils.TestnetFlag, + utils.TaipeiFlag, utils.SyncModeFlag, utils.GCModeFlag, utils.EthStatsURLFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 77a2f07f7..7f6b41f6f 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -129,12 +129,16 @@ var ( } NetworkIdFlag = cli.Uint64Flag{ Name: "networkid", - Usage: "Network identifier (integer, 237=Mainnet, 238=Testnet) (default: 237)", + Usage: "Network identifier (integer, 237=Mainnet, 238=Testnet, 239=Taipei) (default: 237)", Value: eth.DefaultConfig.NetworkId, } TestnetFlag = cli.BoolFlag{ Name: "testnet", - Usage: "Ropsten network: pre-configured proof-of-work test network", + Usage: "Taiwan network: default public testnet", + } + TaipeiFlag = cli.BoolFlag{ + Name: "taipei", + Usage: "Taipei network: tapei public testnet", } ConstantinopleOverrideFlag = cli.Uint64Flag{ Name: "override.constantinople", @@ -157,7 +161,7 @@ var ( Usage: "Document Root for HTTPClient file scheme", Value: DirectoryString{homeDir()}, } - defaultSyncMode = eth.DefaultConfig.SyncMode + defaultSyncMode = dex.DefaultConfig.SyncMode SyncModeFlag = TextMarshalerFlag{ Name: "syncmode", Usage: `Blockchain sync mode ("fast", "full", or "light")`, @@ -645,6 +649,9 @@ func MakeDataDir(ctx *cli.Context) string { if ctx.GlobalBool(TestnetFlag.Name) { return filepath.Join(path, "testnet") } + if ctx.GlobalBool(TaipeiFlag.Name) { + return filepath.Join(path, "taipei") + } return path } Fatalf("Cannot determine default data directory, please set manually (--datadir)") @@ -697,6 +704,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { } case ctx.GlobalBool(TestnetFlag.Name): urls = params.TestnetBootnodes + case ctx.GlobalBool(TaipeiFlag.Name): + urls = params.TaipeiBootnodes case cfg.BootstrapNodes != nil: return // already set, don't apply defaults. } @@ -722,6 +731,8 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) { } else { urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") } + case ctx.GlobalBool(TaipeiFlag.Name): + urls = params.TaipeiBootnodes case cfg.BootstrapNodesV5 != nil: return // already set, don't apply defaults. } @@ -996,6 +1007,8 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) { cfg.DataDir = "" // unless explicitly requested, use memory databases case ctx.GlobalBool(TestnetFlag.Name): cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet") + case ctx.GlobalBool(TaipeiFlag.Name): + cfg.DataDir = filepath.Join(node.DefaultDataDir(), "taipei") } } @@ -1152,7 +1165,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) { // SetDexConfig applies eth-related command line flags to the config. func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) { // Avoid conflicting network flags - checkExclusive(ctx, DeveloperFlag, TestnetFlag) + checkExclusive(ctx, DeveloperFlag, TestnetFlag, TaipeiFlag) checkExclusive(ctx, LightServFlag, SyncModeFlag, "light") ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) @@ -1214,6 +1227,11 @@ func SetDexConfig(ctx *cli.Context, stack *node.Node, cfg *dex.Config) { cfg.NetworkId = 238 } cfg.Genesis = core.DefaultTestnetGenesisBlock() + case ctx.GlobalBool(TaipeiFlag.Name): + if !ctx.GlobalIsSet(NetworkIdFlag.Name) { + cfg.NetworkId = 239 + } + cfg.Genesis = core.DefaultTaipeiGenesisBlock() case ctx.GlobalBool(DeveloperFlag.Name): if !ctx.GlobalIsSet(NetworkIdFlag.Name) { cfg.NetworkId = 1337 @@ -1350,6 +1368,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis { switch { case ctx.GlobalBool(TestnetFlag.Name): genesis = core.DefaultTestnetGenesisBlock() + case ctx.GlobalBool(TaipeiFlag.Name): + genesis = core.DefaultTaipeiGenesisBlock() case ctx.GlobalBool(DeveloperFlag.Name): Fatalf("Developer chains are ephemeral") } |