aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-04 17:36:20 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-05-04 17:36:20 +0800
commitd51a9fd6b7902e35990925c21bfeef427227c628 (patch)
tree25f73247739c0c88a4737f605d9a574872acaf64 /cmd
parente1dc7ece624a2f539b71f1dfb5901047f7a9f214 (diff)
downloaddexon-d51a9fd6b7902e35990925c21bfeef427227c628.tar
dexon-d51a9fd6b7902e35990925c21bfeef427227c628.tar.gz
dexon-d51a9fd6b7902e35990925c21bfeef427227c628.tar.bz2
dexon-d51a9fd6b7902e35990925c21bfeef427227c628.tar.lz
dexon-d51a9fd6b7902e35990925c21bfeef427227c628.tar.xz
dexon-d51a9fd6b7902e35990925c21bfeef427227c628.tar.zst
dexon-d51a9fd6b7902e35990925c21bfeef427227c628.zip
cmd, core, params: add --rinkeby flag for fast connectivity
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go3
-rw-r--r--cmd/geth/usage.go3
-rw-r--r--cmd/utils/flags.go47
3 files changed, 38 insertions, 15 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index ad7b639a3..a3ec724b7 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -133,7 +133,8 @@ func init() {
utils.PreloadJSFlag,
utils.WhisperEnabledFlag,
utils.DevModeFlag,
- utils.TestNetFlag,
+ utils.TestnetFlag,
+ utils.RinkebyFlag,
utils.VMEnableDebugFlag,
utils.NetworkIdFlag,
utils.RPCCORSDomainFlag,
diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go
index 9f06a308b..5012a4b38 100644
--- a/cmd/geth/usage.go
+++ b/cmd/geth/usage.go
@@ -69,7 +69,8 @@ var AppHelpFlagGroups = []flagGroup{
utils.KeyStoreDirFlag,
utils.NoUSBFlag,
utils.NetworkIdFlag,
- utils.TestNetFlag,
+ utils.TestnetFlag,
+ utils.RinkebyFlag,
utils.DevModeFlag,
utils.SyncModeFlag,
utils.EthStatsURLFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index c47301dfb..bb3c51fa1 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -150,13 +150,17 @@ var (
}
NetworkIdFlag = cli.Uint64Flag{
Name: "networkid",
- Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten)",
+ Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
Value: eth.DefaultConfig.NetworkId,
}
- TestNetFlag = cli.BoolFlag{
+ TestnetFlag = cli.BoolFlag{
Name: "testnet",
Usage: "Ropsten network: pre-configured proof-of-work test network",
}
+ RinkebyFlag = cli.BoolFlag{
+ Name: "rinkeby",
+ Usage: "Rinkeby network: pre-configured proof-of-authority test network",
+ }
DevModeFlag = cli.BoolFlag{
Name: "dev",
Usage: "Developer mode: pre-configured private network with several debugging flags",
@@ -415,10 +419,12 @@ var (
// the a subdirectory of the specified datadir will be used.
func MakeDataDir(ctx *cli.Context) string {
if path := ctx.GlobalString(DataDirFlag.Name); path != "" {
- // TODO: choose a different location outside of the regular datadir.
- if ctx.GlobalBool(TestNetFlag.Name) {
+ if ctx.GlobalBool(TestnetFlag.Name) {
return filepath.Join(path, "testnet")
}
+ if ctx.GlobalBool(RinkebyFlag.Name) {
+ return filepath.Join(path, "rinkeby")
+ }
return path
}
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@@ -462,10 +468,13 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
// flags, reverting to pre-configured ones if none have been specified.
func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls := params.MainnetBootnodes
- if ctx.GlobalIsSet(BootnodesFlag.Name) {
+ switch {
+ case ctx.GlobalIsSet(BootnodesFlag.Name):
urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
- } else if ctx.GlobalBool(TestNetFlag.Name) {
+ case ctx.GlobalBool(TestnetFlag.Name):
urls = params.TestnetBootnodes
+ case ctx.GlobalBool(RinkebyFlag.Name):
+ urls = params.RinkebyBootnodes
}
cfg.BootstrapNodes = make([]*discover.Node, 0, len(urls))
@@ -483,9 +492,12 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
// flags, reverting to pre-configured ones if none have been specified.
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
urls := params.DiscoveryV5Bootnodes
- if ctx.GlobalIsSet(BootnodesFlag.Name) {
+ switch {
+ case ctx.GlobalIsSet(BootnodesFlag.Name):
urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",")
- } else if cfg.BootstrapNodesV5 == nil {
+ case ctx.GlobalBool(RinkebyFlag.Name):
+ urls = params.RinkebyV5Bootnodes
+ case cfg.BootstrapNodesV5 != nil:
return // already set, don't apply defaults.
}
@@ -723,8 +735,10 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
case ctx.GlobalBool(DevModeFlag.Name):
cfg.DataDir = filepath.Join(os.TempDir(), "ethereum_dev_mode")
- case ctx.GlobalBool(TestNetFlag.Name):
+ case ctx.GlobalBool(TestnetFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
+ case ctx.GlobalBool(RinkebyFlag.Name):
+ cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
}
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
@@ -783,7 +797,7 @@ func checkExclusive(ctx *cli.Context, flags ...cli.Flag) {
// 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, DevModeFlag, TestNetFlag)
+ checkExclusive(ctx, DevModeFlag, TestnetFlag, RinkebyFlag)
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
@@ -835,13 +849,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
cfg.EnablePreimageRecording = ctx.GlobalBool(VMEnableDebugFlag.Name)
}
- // Override any default configs for --dev and --testnet.
+ // Override any default configs for hard coded networks.
switch {
- case ctx.GlobalBool(TestNetFlag.Name):
+ case ctx.GlobalBool(TestnetFlag.Name):
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 3
}
cfg.Genesis = core.DefaultTestnetGenesisBlock()
+ case ctx.GlobalBool(RinkebyFlag.Name):
+ if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
+ cfg.NetworkId = 4
+ }
+ cfg.Genesis = core.DefaultRinkebyGenesisBlock()
case ctx.GlobalBool(DevModeFlag.Name):
cfg.Genesis = core.DevGenesisBlock()
if !ctx.GlobalIsSet(GasPriceFlag.Name) {
@@ -928,8 +947,10 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
func MakeGenesis(ctx *cli.Context) *core.Genesis {
var genesis *core.Genesis
switch {
- case ctx.GlobalBool(TestNetFlag.Name):
+ case ctx.GlobalBool(TestnetFlag.Name):
genesis = core.DefaultTestnetGenesisBlock()
+ case ctx.GlobalBool(RinkebyFlag.Name):
+ genesis = core.DefaultRinkebyGenesisBlock()
case ctx.GlobalBool(DevModeFlag.Name):
genesis = core.DevGenesisBlock()
}