aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-10-09 16:31:37 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-10-09 16:31:37 +0800
commit315a422ba754eae10db21990a809f608f7af62d4 (patch)
tree56924b100b906cd4f6da5ac13540c175df756988 /cmd
parent9e91579105e94395a108d43ec3ac0ae0e0f139c5 (diff)
parent1de796f10134bb4aa245591e0d8802e320892efb (diff)
downloadgo-tangerine-315a422ba754eae10db21990a809f608f7af62d4.tar.gz
go-tangerine-315a422ba754eae10db21990a809f608f7af62d4.tar.zst
go-tangerine-315a422ba754eae10db21990a809f608f7af62d4.zip
Merge pull request #1888 from obscuren/testnet
cmd, core, eth: added official testnet
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/utils/flags.go18
2 files changed, 19 insertions, 0 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 2d2c38ce8..1eb078201 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -314,6 +314,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils.ExecFlag,
utils.WhisperEnabledFlag,
utils.DevModeFlag,
+ utils.TestNetFlag,
utils.VMDebugFlag,
utils.VMForceJitFlag,
utils.VMJitCacheFlag,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index e2184003c..53faeefdc 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -127,6 +127,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",
@@ -454,6 +458,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
@@ -555,6 +570,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)
}