@@ -121,6 +121,10 @@ var (
121121 Name : "genesis" ,
122122 Usage : "Inserts/Overwrites the genesis block (json format)" ,
123123 }
124+ DevModeFlag = cli.BoolFlag {
125+ Name : "dev" ,
126+ Usage : "Developer mode. This mode creates a private network and sets several debugging flags" ,
127+ }
124128 IdentityFlag = cli.StringFlag {
125129 Name : "identity" ,
126130 Usage : "Custom node name" ,
@@ -410,7 +414,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
410414 glog .V (logger .Error ).Infoln ("WARNING: No etherbase set and no accounts found as default" )
411415 }
412416
413- return & eth.Config {
417+ cfg := & eth.Config {
414418 Name : common .MakeName (clientID , version ),
415419 DataDir : ctx .GlobalString (DataDirFlag .Name ),
416420 GenesisNonce : ctx .GlobalInt (GenesisNonceFlag .Name ),
@@ -447,6 +451,33 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
447451 SolcPath : ctx .GlobalString (SolcPathFlag .Name ),
448452 AutoDAG : ctx .GlobalBool (AutoDAGFlag .Name ) || ctx .GlobalBool (MiningEnabledFlag .Name ),
449453 }
454+
455+ if ctx .GlobalBool (DevModeFlag .Name ) {
456+ if ! ctx .GlobalIsSet (VMDebugFlag .Name ) {
457+ cfg .VmDebug = true
458+ }
459+ if ! ctx .GlobalIsSet (MaxPeersFlag .Name ) {
460+ cfg .MaxPeers = 0
461+ }
462+ if ! ctx .GlobalIsSet (GasPriceFlag .Name ) {
463+ cfg .GasPrice = new (big.Int )
464+ }
465+ if ! ctx .GlobalIsSet (ListenPortFlag .Name ) {
466+ cfg .Port = "0" // auto port
467+ }
468+ if ! ctx .GlobalIsSet (WhisperEnabledFlag .Name ) {
469+ cfg .Shh = true
470+ }
471+ if ! ctx .GlobalIsSet (DataDirFlag .Name ) {
472+ cfg .DataDir = os .TempDir () + "/ethereum_dev_mode"
473+ }
474+ cfg .PowTest = true
475+ cfg .DevMode = true
476+
477+ glog .V (logger .Info ).Infoln ("dev mode enabled" )
478+ }
479+
480+ return cfg
450481}
451482
452483// SetupLogger configures glog from the logging-related command line flags.
0 commit comments