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
d51a9fd6
Unverified
Commit
d51a9fd6
authored
8 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd, core, params: add --rinkeby flag for fast connectivity
parent
e1dc7ece
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
16 deletions
+80
-16
main.go
cmd/geth/main.go
+2
-1
usage.go
cmd/geth/usage.go
+2
-1
flags.go
cmd/utils/flags.go
+34
-13
genesis.go
core/genesis.go
+12
-0
genesis_alloc.go
core/genesis_alloc.go
+1
-0
bootnodes.go
params/bootnodes.go
+12
-0
config.go
params/config.go
+17
-1
No files found.
cmd/geth/main.go
View file @
d51a9fd6
...
...
@@ -133,7 +133,8 @@ func init() {
utils
.
PreloadJSFlag
,
utils
.
WhisperEnabledFlag
,
utils
.
DevModeFlag
,
utils
.
TestNetFlag
,
utils
.
TestnetFlag
,
utils
.
RinkebyFlag
,
utils
.
VMEnableDebugFlag
,
utils
.
NetworkIdFlag
,
utils
.
RPCCORSDomainFlag
,
...
...
This diff is collapsed.
Click to expand it.
cmd/geth/usage.go
View file @
d51a9fd6
...
...
@@ -69,7 +69,8 @@ var AppHelpFlagGroups = []flagGroup{
utils
.
KeyStoreDirFlag
,
utils
.
NoUSBFlag
,
utils
.
NetworkIdFlag
,
utils
.
TestNetFlag
,
utils
.
TestnetFlag
,
utils
.
RinkebyFlag
,
utils
.
DevModeFlag
,
utils
.
SyncModeFlag
,
utils
.
EthStatsURLFlag
,
...
...
This diff is collapsed.
Click to expand it.
cmd/utils/flags.go
View file @
d51a9fd6
...
...
@@ -150,13 +150,17 @@ var (
}
NetworkIdFlag
=
cli
.
Uint64Flag
{
Name
:
"networkid"
,
Usage
:
"Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten)"
,
Usage
:
"Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten
, 4=Rinkeby
)"
,
Value
:
eth
.
DefaultConfig
.
NetworkId
,
}
Test
N
etFlag
=
cli
.
BoolFlag
{
Test
n
etFlag
=
cli
.
BoolFlag
{
Name
:
"testnet"
,
Usage
:
"Ropsten network: pre-configured proof-of-work test network"
,
}
RinkebyFlag
=
cli
.
BoolFlag
{
Name
:
"rinkeby"
,
Usage
:
"Rinkeby network: pre-configured proof-of-authority test network"
,
}
DevModeFlag
=
cli
.
BoolFlag
{
Name
:
"dev"
,
Usage
:
"Developer mode: pre-configured private network with several debugging flags"
,
...
...
@@ -415,10 +419,12 @@ var (
// the a subdirectory of the specified datadir will be used.
func
MakeDataDir
(
ctx
*
cli
.
Context
)
string
{
if
path
:=
ctx
.
GlobalString
(
DataDirFlag
.
Name
);
path
!=
""
{
// TODO: choose a different location outside of the regular datadir.
if
ctx
.
GlobalBool
(
TestNetFlag
.
Name
)
{
if
ctx
.
GlobalBool
(
TestnetFlag
.
Name
)
{
return
filepath
.
Join
(
path
,
"testnet"
)
}
if
ctx
.
GlobalBool
(
RinkebyFlag
.
Name
)
{
return
filepath
.
Join
(
path
,
"rinkeby"
)
}
return
path
}
Fatalf
(
"Cannot determine default data directory, please set manually (--datadir)"
)
...
...
@@ -462,10 +468,13 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
// flags, reverting to pre-configured ones if none have been specified.
func
setBootstrapNodes
(
ctx
*
cli
.
Context
,
cfg
*
p2p
.
Config
)
{
urls
:=
params
.
MainnetBootnodes
if
ctx
.
GlobalIsSet
(
BootnodesFlag
.
Name
)
{
switch
{
case
ctx
.
GlobalIsSet
(
BootnodesFlag
.
Name
)
:
urls
=
strings
.
Split
(
ctx
.
GlobalString
(
BootnodesFlag
.
Name
),
","
)
}
else
if
ctx
.
GlobalBool
(
TestNetFlag
.
Name
)
{
case
ctx
.
GlobalBool
(
TestnetFlag
.
Name
)
:
urls
=
params
.
TestnetBootnodes
case
ctx
.
GlobalBool
(
RinkebyFlag
.
Name
)
:
urls
=
params
.
RinkebyBootnodes
}
cfg
.
BootstrapNodes
=
make
([]
*
discover
.
Node
,
0
,
len
(
urls
))
...
...
@@ -483,9 +492,12 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
// flags, reverting to pre-configured ones if none have been specified.
func
setBootstrapNodesV5
(
ctx
*
cli
.
Context
,
cfg
*
p2p
.
Config
)
{
urls
:=
params
.
DiscoveryV5Bootnodes
if
ctx
.
GlobalIsSet
(
BootnodesFlag
.
Name
)
{
switch
{
case
ctx
.
GlobalIsSet
(
BootnodesFlag
.
Name
)
:
urls
=
strings
.
Split
(
ctx
.
GlobalString
(
BootnodesFlag
.
Name
),
","
)
}
else
if
cfg
.
BootstrapNodesV5
==
nil
{
case
ctx
.
GlobalBool
(
RinkebyFlag
.
Name
)
:
urls
=
params
.
RinkebyV5Bootnodes
case
cfg
.
BootstrapNodesV5
!=
nil
:
return
// already set, don't apply defaults.
}
...
...
@@ -723,8 +735,10 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
cfg
.
DataDir
=
ctx
.
GlobalString
(
DataDirFlag
.
Name
)
case
ctx
.
GlobalBool
(
DevModeFlag
.
Name
)
:
cfg
.
DataDir
=
filepath
.
Join
(
os
.
TempDir
(),
"ethereum_dev_mode"
)
case
ctx
.
GlobalBool
(
Test
N
etFlag
.
Name
)
:
case
ctx
.
GlobalBool
(
Test
n
etFlag
.
Name
)
:
cfg
.
DataDir
=
filepath
.
Join
(
node
.
DefaultDataDir
(),
"testnet"
)
case
ctx
.
GlobalBool
(
RinkebyFlag
.
Name
)
:
cfg
.
DataDir
=
filepath
.
Join
(
node
.
DefaultDataDir
(),
"rinkeby"
)
}
if
ctx
.
GlobalIsSet
(
KeyStoreDirFlag
.
Name
)
{
...
...
@@ -783,7 +797,7 @@ func checkExclusive(ctx *cli.Context, flags ...cli.Flag) {
// SetEthConfig applies eth-related command line flags to the config.
func
SetEthConfig
(
ctx
*
cli
.
Context
,
stack
*
node
.
Node
,
cfg
*
eth
.
Config
)
{
// Avoid conflicting network flags
checkExclusive
(
ctx
,
DevModeFlag
,
Test
Net
Flag
)
checkExclusive
(
ctx
,
DevModeFlag
,
Test
netFlag
,
Rinkeby
Flag
)
checkExclusive
(
ctx
,
FastSyncFlag
,
LightModeFlag
,
SyncModeFlag
)
ks
:=
stack
.
AccountManager
()
.
Backends
(
keystore
.
KeyStoreType
)[
0
]
.
(
*
keystore
.
KeyStore
)
...
...
@@ -835,13 +849,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
cfg
.
EnablePreimageRecording
=
ctx
.
GlobalBool
(
VMEnableDebugFlag
.
Name
)
}
// Override any default configs for
--dev and --testnet
.
// Override any default configs for
hard coded networks
.
switch
{
case
ctx
.
GlobalBool
(
Test
N
etFlag
.
Name
)
:
case
ctx
.
GlobalBool
(
Test
n
etFlag
.
Name
)
:
if
!
ctx
.
GlobalIsSet
(
NetworkIdFlag
.
Name
)
{
cfg
.
NetworkId
=
3
}
cfg
.
Genesis
=
core
.
DefaultTestnetGenesisBlock
()
case
ctx
.
GlobalBool
(
RinkebyFlag
.
Name
)
:
if
!
ctx
.
GlobalIsSet
(
NetworkIdFlag
.
Name
)
{
cfg
.
NetworkId
=
4
}
cfg
.
Genesis
=
core
.
DefaultRinkebyGenesisBlock
()
case
ctx
.
GlobalBool
(
DevModeFlag
.
Name
)
:
cfg
.
Genesis
=
core
.
DevGenesisBlock
()
if
!
ctx
.
GlobalIsSet
(
GasPriceFlag
.
Name
)
{
...
...
@@ -928,8 +947,10 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node) ethdb.Database {
func
MakeGenesis
(
ctx
*
cli
.
Context
)
*
core
.
Genesis
{
var
genesis
*
core
.
Genesis
switch
{
case
ctx
.
GlobalBool
(
Test
N
etFlag
.
Name
)
:
case
ctx
.
GlobalBool
(
Test
n
etFlag
.
Name
)
:
genesis
=
core
.
DefaultTestnetGenesisBlock
()
case
ctx
.
GlobalBool
(
RinkebyFlag
.
Name
)
:
genesis
=
core
.
DefaultRinkebyGenesisBlock
()
case
ctx
.
GlobalBool
(
DevModeFlag
.
Name
)
:
genesis
=
core
.
DevGenesisBlock
()
}
...
...
This diff is collapsed.
Click to expand it.
core/genesis.go
View file @
d51a9fd6
...
...
@@ -278,6 +278,18 @@ func DefaultTestnetGenesisBlock() *Genesis {
}
}
// DefaultRinkebyGenesisBlock returns the Rinkeby network genesis block.
func
DefaultRinkebyGenesisBlock
()
*
Genesis
{
return
&
Genesis
{
Config
:
params
.
RinkebyChainConfig
,
Timestamp
:
1492009146
,
ExtraData
:
hexutil
.
MustDecode
(
"0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
),
GasLimit
:
4700000
,
Difficulty
:
big
.
NewInt
(
1
),
Alloc
:
decodePrealloc
(
rinkebyAllocData
),
}
}
// DevGenesisBlock returns the 'geth --dev' genesis block.
func
DevGenesisBlock
()
*
Genesis
{
return
&
Genesis
{
...
...
This diff is collapsed.
Click to expand it.
core/genesis_alloc.go
View file @
d51a9fd6
This diff is collapsed.
Click to expand it.
params/bootnodes.go
View file @
d51a9fd6
...
...
@@ -39,6 +39,18 @@ var TestnetBootnodes = []string{
"enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303"
,
// IE
}
// RinkebyBootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Rinkeby test network.
var
RinkebyBootnodes
=
[]
string
{
"enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303"
,
// IE
}
// RinkebyV5Bootnodes are the enode URLs of the P2P bootstrap nodes running on the
// Rinkeby test network for the experimental RLPx v5 topic-discovery network.
var
RinkebyV5Bootnodes
=
[]
string
{
"enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303?discport=30304"
,
// IE
}
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
// experimental RLPx v5 topic-discovery network.
var
DiscoveryV5Bootnodes
=
[]
string
{
...
...
This diff is collapsed.
Click to expand it.
params/config.go
View file @
d51a9fd6
...
...
@@ -37,7 +37,7 @@ var (
Ethash
:
new
(
EthashConfig
),
}
// TestnetChainConfig contains the chain parameters to run a node on the
r
opsten test network.
// TestnetChainConfig contains the chain parameters to run a node on the
R
opsten test network.
TestnetChainConfig
=
&
ChainConfig
{
ChainId
:
big
.
NewInt
(
3
),
HomesteadBlock
:
big
.
NewInt
(
0
),
...
...
@@ -50,6 +50,22 @@ var (
Ethash
:
new
(
EthashConfig
),
}
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
RinkebyChainConfig
=
&
ChainConfig
{
ChainId
:
big
.
NewInt
(
4
),
HomesteadBlock
:
big
.
NewInt
(
1
),
DAOForkBlock
:
nil
,
DAOForkSupport
:
true
,
EIP150Block
:
big
.
NewInt
(
2
),
EIP150Hash
:
common
.
HexToHash
(
"0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"
),
EIP155Block
:
big
.
NewInt
(
3
),
EIP158Block
:
big
.
NewInt
(
3
),
Clique
:
&
CliqueConfig
{
Period
:
15
,
Epoch
:
30000
,
},
}
// AllProtocolChanges contains every protocol change (EIPs)
// introduced and accepted by the Ethereum core developers.
// TestChainConfig is like AllProtocolChanges but has chain ID 1.
...
...
This diff is collapsed.
Click to expand it.
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