@ -162,20 +162,24 @@ var (
}
}
NetworkIdFlag = cli . Uint64Flag {
NetworkIdFlag = cli . Uint64Flag {
Name : "networkid" ,
Name : "networkid" ,
Usage : "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)" ,
Usage : "Network identifier (integer, 1=Frontier, 3=Ropsten, 4=Rinkeby, 5=Görli )" ,
Value : eth . DefaultConfig . NetworkId ,
Value : eth . DefaultConfig . NetworkId ,
}
}
TestnetFlag = cli . BoolFlag {
Legacy TestnetFlag = cli . BoolFlag { // TODO(q9f): Remove after Ropsten is discontinued.
Name : "testnet" ,
Name : "testnet" ,
Usage : "Ropsten network: pre-configured proof-of-work test network" ,
Usage : "Pre-configured test network (Deprecated: Please choose one of --goerli, --rinkeby, or --ropsten.)" ,
}
GoerliFlag = cli . BoolFlag {
Name : "goerli" ,
Usage : "Görli network: pre-configured proof-of-authority test network" ,
}
}
RinkebyFlag = cli . BoolFlag {
RinkebyFlag = cli . BoolFlag {
Name : "rinkeby" ,
Name : "rinkeby" ,
Usage : "Rinkeby network: pre-configured proof-of-authority test network" ,
Usage : "Rinkeby network: pre-configured proof-of-authority test network" ,
}
}
Goerli Flag = cli . BoolFlag {
Ropsten Flag = cli . BoolFlag {
Name : "goerli " ,
Name : "ropsten " ,
Usage : "Görli network: pre-configured proof-of-authority test network" ,
Usage : "Ropsten network: pre-configured proof-of-work test network" ,
}
}
DeveloperFlag = cli . BoolFlag {
DeveloperFlag = cli . BoolFlag {
Name : "dev" ,
Name : "dev" ,
@ -759,7 +763,6 @@ var (
Usage : "Comma-separated InfluxDB tags (key/values) attached to all measurements" ,
Usage : "Comma-separated InfluxDB tags (key/values) attached to all measurements" ,
Value : "host=localhost" ,
Value : "host=localhost" ,
}
}
EWASMInterpreterFlag = cli . StringFlag {
EWASMInterpreterFlag = cli . StringFlag {
Name : "vm.ewasm" ,
Name : "vm.ewasm" ,
Usage : "External ewasm configuration (default = built-in interpreter)" ,
Usage : "External ewasm configuration (default = built-in interpreter)" ,
@ -774,11 +777,17 @@ var (
// MakeDataDir retrieves the currently requested data directory, terminating
// MakeDataDir retrieves the currently requested data directory, terminating
// if none (or the empty string) is specified. If the node is starting a testnet,
// if none (or the empty string) is specified. If the node is starting a testnet,
// the a subdirectory of the specified datadir will be used.
// then a subdirectory of the specified datadir will be used.
func MakeDataDir ( ctx * cli . Context ) string {
func MakeDataDir ( ctx * cli . Context ) string {
if path := ctx . GlobalString ( DataDirFlag . Name ) ; path != "" {
if path := ctx . GlobalString ( DataDirFlag . Name ) ; path != "" {
if ctx . GlobalBool ( TestnetFlag . Name ) {
if ctx . GlobalBool ( LegacyTestnetFlag . Name ) || ctx . GlobalBool ( RopstenFlag . Name ) {
return filepath . Join ( path , "testnet" )
// Maintain compatibility with older Geth configurations storing the
// Ropsten database in `testnet` instead of `ropsten`.
legacyPath := filepath . Join ( path , "testnet" )
if _ , err := os . Stat ( legacyPath ) ; ! os . IsNotExist ( err ) {
return legacyPath
}
return filepath . Join ( path , "ropsten" )
}
}
if ctx . GlobalBool ( RinkebyFlag . Name ) {
if ctx . GlobalBool ( RinkebyFlag . Name ) {
return filepath . Join ( path , "rinkeby" )
return filepath . Join ( path , "rinkeby" )
@ -836,8 +845,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
} else {
} else {
urls = splitAndTrim ( ctx . GlobalString ( BootnodesFlag . Name ) )
urls = splitAndTrim ( ctx . GlobalString ( BootnodesFlag . Name ) )
}
}
case ctx . GlobalBool ( TestnetFlag . Name ) :
case ctx . GlobalBool ( Legacy TestnetFlag . Name ) || ctx . GlobalBool ( Ropsten Flag. Name ) :
urls = params . Testnet Bootnodes
urls = params . Ropsten Bootnodes
case ctx . GlobalBool ( RinkebyFlag . Name ) :
case ctx . GlobalBool ( RinkebyFlag . Name ) :
urls = params . RinkebyBootnodes
urls = params . RinkebyBootnodes
case ctx . GlobalBool ( GoerliFlag . Name ) :
case ctx . GlobalBool ( GoerliFlag . Name ) :
@ -1240,8 +1249,16 @@ func setDataDir(ctx *cli.Context, cfg *node.Config) {
cfg . DataDir = ctx . GlobalString ( DataDirFlag . Name )
cfg . DataDir = ctx . GlobalString ( DataDirFlag . Name )
case ctx . GlobalBool ( DeveloperFlag . Name ) :
case ctx . GlobalBool ( DeveloperFlag . Name ) :
cfg . DataDir = "" // unless explicitly requested, use memory databases
cfg . DataDir = "" // unless explicitly requested, use memory databases
case ctx . GlobalBool ( TestnetFlag . Name ) && cfg . DataDir == node . DefaultDataDir ( ) :
case ( ctx . GlobalBool ( LegacyTestnetFlag . Name ) || ctx . GlobalBool ( RopstenFlag . Name ) ) && cfg . DataDir == node . DefaultDataDir ( ) :
cfg . DataDir = filepath . Join ( node . DefaultDataDir ( ) , "testnet" )
// Maintain compatibility with older Geth configurations storing the
// Ropsten database in `testnet` instead of `ropsten`.
legacyPath := filepath . Join ( node . DefaultDataDir ( ) , "testnet" )
if _ , err := os . Stat ( legacyPath ) ; ! os . IsNotExist ( err ) {
log . Warn ( "Using the deprecated `testnet` datadir. Future versions will store the Ropsten chain in `ropsten`." )
cfg . DataDir = legacyPath
} else {
cfg . DataDir = filepath . Join ( node . DefaultDataDir ( ) , "ropsten" )
}
case ctx . GlobalBool ( RinkebyFlag . Name ) && cfg . DataDir == node . DefaultDataDir ( ) :
case ctx . GlobalBool ( RinkebyFlag . Name ) && cfg . DataDir == node . DefaultDataDir ( ) :
cfg . DataDir = filepath . Join ( node . DefaultDataDir ( ) , "rinkeby" )
cfg . DataDir = filepath . Join ( node . DefaultDataDir ( ) , "rinkeby" )
case ctx . GlobalBool ( GoerliFlag . Name ) && cfg . DataDir == node . DefaultDataDir ( ) :
case ctx . GlobalBool ( GoerliFlag . Name ) && cfg . DataDir == node . DefaultDataDir ( ) :
@ -1441,7 +1458,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
// SetEthConfig applies eth-related command line flags to the config.
// SetEthConfig applies eth-related command line flags to the config.
func SetEthConfig ( ctx * cli . Context , stack * node . Node , cfg * eth . Config ) {
func SetEthConfig ( ctx * cli . Context , stack * node . Node , cfg * eth . Config ) {
// Avoid conflicting network flags
// Avoid conflicting network flags
CheckExclusive ( ctx , DeveloperFlag , TestnetFlag , RinkebyFlag , GoerliFlag )
CheckExclusive ( ctx , DeveloperFlag , Legacy TestnetFlag , Ropsten Flag, RinkebyFlag , GoerliFlag )
CheckExclusive ( ctx , LightLegacyServFlag , LightServeFlag , SyncModeFlag , "light" )
CheckExclusive ( ctx , LightLegacyServFlag , LightServeFlag , SyncModeFlag , "light" )
CheckExclusive ( ctx , DeveloperFlag , ExternalSignerFlag ) // Can't use both ephemeral unlocked and external signer
CheckExclusive ( ctx , DeveloperFlag , ExternalSignerFlag ) // Can't use both ephemeral unlocked and external signer
@ -1521,12 +1538,12 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
// Override any default configs for hard coded networks.
// Override any default configs for hard coded networks.
switch {
switch {
case ctx . GlobalBool ( TestnetFlag . Name ) :
case ctx . GlobalBool ( Legacy TestnetFlag . Name ) || ctx . GlobalBool ( Ropsten Flag. Name ) :
if ! ctx . GlobalIsSet ( NetworkIdFlag . Name ) {
if ! ctx . GlobalIsSet ( NetworkIdFlag . Name ) {
cfg . NetworkId = 3
cfg . NetworkId = 3
}
}
cfg . Genesis = core . DefaultTestnet GenesisBlock ( )
cfg . Genesis = core . DefaultRopsten GenesisBlock ( )
setDNSDiscoveryDefaults ( cfg , params . KnownDNSNetworks [ params . Testnet GenesisHash] )
setDNSDiscoveryDefaults ( cfg , params . KnownDNSNetworks [ params . Ropsten GenesisHash] )
case ctx . GlobalBool ( RinkebyFlag . Name ) :
case ctx . GlobalBool ( RinkebyFlag . Name ) :
if ! ctx . GlobalIsSet ( NetworkIdFlag . Name ) {
if ! ctx . GlobalIsSet ( NetworkIdFlag . Name ) {
cfg . NetworkId = 4
cfg . NetworkId = 4
@ -1708,8 +1725,8 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
func MakeGenesis ( ctx * cli . Context ) * core . Genesis {
func MakeGenesis ( ctx * cli . Context ) * core . Genesis {
var genesis * core . Genesis
var genesis * core . Genesis
switch {
switch {
case ctx . GlobalBool ( TestnetFlag . Name ) :
case ctx . GlobalBool ( Legacy TestnetFlag . Name ) || ctx . GlobalBool ( Ropsten Flag. Name ) :
genesis = core . DefaultTestnet GenesisBlock ( )
genesis = core . DefaultRopsten GenesisBlock ( )
case ctx . GlobalBool ( RinkebyFlag . Name ) :
case ctx . GlobalBool ( RinkebyFlag . Name ) :
genesis = core . DefaultRinkebyGenesisBlock ( )
genesis = core . DefaultRinkebyGenesisBlock ( )
case ctx . GlobalBool ( GoerliFlag . Name ) :
case ctx . GlobalBool ( GoerliFlag . Name ) :