aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-10-05 19:01:34 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-10-09 04:01:39 +0800
commit1de796f10134bb4aa245591e0d8802e320892efb (patch)
treedff14c87d5c29b779ab1e4543acd66489ea55bb2 /cmd/utils
parent44fd3951410fb5923d7e578ac97942a7ea791e96 (diff)
downloadgo-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.tar
go-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.tar.gz
go-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.tar.bz2
go-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.tar.lz
go-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.tar.xz
go-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.tar.zst
go-tangerine-1de796f10134bb4aa245591e0d8802e320892efb.zip
cmd, core, eth: added official testnet
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index dea43bc5c..67f8f0c57 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -125,6 +125,10 @@ var (
Name: "dev",
Usage: "Developer mode. This mode creates a private network and sets several debugging flags",
}
+ TestNetFlag = cli.BoolFlag{
+ Name: "testnet",
+ Usage: "Testnet mode. This enables your node to operate on the testnet",
+ }
IdentityFlag = cli.StringFlag{
Name: "identity",
Usage: "Custom node name",
@@ -452,6 +456,17 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
AutoDAG: ctx.GlobalBool(AutoDAGFlag.Name) || ctx.GlobalBool(MiningEnabledFlag.Name),
}
+ if ctx.GlobalBool(DevModeFlag.Name) && ctx.GlobalBool(TestNetFlag.Name) {
+ glog.Fatalf("%s and %s are mutually exclusive\n", DevModeFlag.Name, TestNetFlag.Name)
+ }
+
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ // testnet is always stored in the testnet folder
+ cfg.DataDir += "/testnet"
+ cfg.NetworkId = 2
+ cfg.TestNet = true
+ }
+
if ctx.GlobalBool(DevModeFlag.Name) {
if !ctx.GlobalIsSet(VMDebugFlag.Name) {
cfg.VmDebug = true
@@ -540,6 +555,9 @@ func MakeChain(ctx *cli.Context) (chain *core.BlockChain, chainDb ethdb.Database
// MakeChain creates an account manager from set command line flags.
func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
dataDir := MustDataDir(ctx)
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ dataDir += "/testnet"
+ }
ks := crypto.NewKeyStorePassphrase(filepath.Join(dataDir, "keystore"))
return accounts.NewManager(ks)
}