diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-11-26 13:54:28 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:19 +0800 |
commit | 06276babe273f248ba1177f2a7bc369d09c303dd (patch) | |
tree | e4f4bd4612acc0b693ef93bd8a8177cf982bb94b /cmd/utils | |
parent | afc6a417210dc43a5a38ece5302de6801785316f (diff) | |
download | go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.tar go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.tar.gz go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.tar.bz2 go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.tar.lz go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.tar.xz go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.tar.zst go-tangerine-06276babe273f248ba1177f2a7bc369d09c303dd.zip |
core: add Taipei testnet (#47)
Add a new testnet named Taipei.
Diffstat (limited to 'cmd/utils')
-rw-r--r-- | cmd/utils/flags.go | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index fd5ea757d..03b0841b0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -130,12 +130,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", @@ -158,7 +162,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")`, @@ -650,6 +654,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)") @@ -702,6 +709,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. } @@ -727,6 +736,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. } @@ -1001,6 +1012,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") } } @@ -1157,7 +1170,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) @@ -1222,6 +1235,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 @@ -1375,6 +1393,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") } |