Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
4e075e40
Commit
4e075e40
authored
Sep 10, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1773 from obscuren/dev-mode
cmd/geth, cmd/utils, eth: added dev mode flag
parents
62bbf8a0
f04b3a6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
7 deletions
+42
-7
main.go
cmd/geth/main.go
+1
-0
flags.go
cmd/utils/flags.go
+32
-1
backend.go
eth/backend.go
+9
-6
No files found.
cmd/geth/main.go
View file @
4e075e40
...
...
@@ -308,6 +308,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso
utils
.
IPCPathFlag
,
utils
.
ExecFlag
,
utils
.
WhisperEnabledFlag
,
utils
.
DevModeFlag
,
utils
.
VMDebugFlag
,
utils
.
VMForceJitFlag
,
utils
.
VMJitCacheFlag
,
...
...
cmd/utils/flags.go
View file @
4e075e40
...
...
@@ -121,6 +121,10 @@ var (
Name
:
"genesis"
,
Usage
:
"Inserts/Overwrites the genesis block (json format)"
,
}
DevModeFlag
=
cli
.
BoolFlag
{
Name
:
"dev"
,
Usage
:
"Developer mode. This mode creates a private network and sets several debugging flags"
,
}
IdentityFlag
=
cli
.
StringFlag
{
Name
:
"identity"
,
Usage
:
"Custom node name"
,
...
...
@@ -410,7 +414,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"WARNING: No etherbase set and no accounts found as default"
)
}
return
&
eth
.
Config
{
cfg
:=
&
eth
.
Config
{
Name
:
common
.
MakeName
(
clientID
,
version
),
DataDir
:
ctx
.
GlobalString
(
DataDirFlag
.
Name
),
GenesisNonce
:
ctx
.
GlobalInt
(
GenesisNonceFlag
.
Name
),
...
...
@@ -447,6 +451,33 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
SolcPath
:
ctx
.
GlobalString
(
SolcPathFlag
.
Name
),
AutoDAG
:
ctx
.
GlobalBool
(
AutoDAGFlag
.
Name
)
||
ctx
.
GlobalBool
(
MiningEnabledFlag
.
Name
),
}
if
ctx
.
GlobalBool
(
DevModeFlag
.
Name
)
{
if
!
ctx
.
GlobalIsSet
(
VMDebugFlag
.
Name
)
{
cfg
.
VmDebug
=
true
}
if
!
ctx
.
GlobalIsSet
(
MaxPeersFlag
.
Name
)
{
cfg
.
MaxPeers
=
0
}
if
!
ctx
.
GlobalIsSet
(
GasPriceFlag
.
Name
)
{
cfg
.
GasPrice
=
new
(
big
.
Int
)
}
if
!
ctx
.
GlobalIsSet
(
ListenPortFlag
.
Name
)
{
cfg
.
Port
=
"0"
// auto port
}
if
!
ctx
.
GlobalIsSet
(
WhisperEnabledFlag
.
Name
)
{
cfg
.
Shh
=
true
}
if
!
ctx
.
GlobalIsSet
(
DataDirFlag
.
Name
)
{
cfg
.
DataDir
=
os
.
TempDir
()
+
"/ethereum_dev_mode"
}
cfg
.
PowTest
=
true
cfg
.
DevMode
=
true
glog
.
V
(
logger
.
Info
)
.
Infoln
(
"dev mode enabled"
)
}
return
cfg
}
// SetupLogger configures glog from the logging-related command line flags.
...
...
eth/backend.go
View file @
4e075e40
...
...
@@ -73,6 +73,8 @@ var (
)
type
Config
struct
{
DevMode
bool
Name
string
NetworkId
int
GenesisNonce
int
...
...
@@ -303,16 +305,17 @@ func New(config *Config) (*Ethereum, error) {
glog
.
V
(
logger
.
Info
)
.
Infof
(
"Successfully wrote genesis block. New genesis hash = %x
\n
"
,
block
.
Hash
())
}
if
config
.
Olympic
{
// different modes
switch
{
case
config
.
Olympic
:
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"Starting Olympic network"
)
fallthrough
case
config
.
DevMode
:
_
,
err
:=
core
.
WriteTestNetGenesisBlock
(
chainDb
,
42
)
if
err
!=
nil
{
return
nil
,
err
}
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"Starting Olympic network"
)
}
// This is for testing only.
if
config
.
GenesisBlock
!=
nil
{
case
config
.
GenesisBlock
!=
nil
:
// This is for testing only.
core
.
WriteBlock
(
chainDb
,
config
.
GenesisBlock
)
core
.
WriteHead
(
chainDb
,
config
.
GenesisBlock
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment