Skip to content

Commit f2f493b

Browse files
markya0616tailingchen
authored andcommitted
cmd/*, core, params: add ottoman testnet
1 parent 2b7bda3 commit f2f493b

File tree

7 files changed

+63
-2
lines changed

7 files changed

+63
-2
lines changed

cmd/geth/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ var (
101101
utils.DevModeFlag,
102102
utils.TestnetFlag,
103103
utils.RinkebyFlag,
104+
utils.OttomanFlag,
104105
utils.VMEnableDebugFlag,
105106
utils.NetworkIdFlag,
106107
utils.RPCCORSDomainFlag,

cmd/geth/usage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ var AppHelpFlagGroups = []flagGroup{
7272
utils.NetworkIdFlag,
7373
utils.TestnetFlag,
7474
utils.RinkebyFlag,
75+
utils.OttomanFlag,
7576
utils.DevModeFlag,
7677
utils.SyncModeFlag,
7778
utils.EthStatsURLFlag,

cmd/utils/flags.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ var (
125125
}
126126
NetworkIdFlag = cli.Uint64Flag{
127127
Name: "networkid",
128-
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby)",
128+
Usage: "Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby, 5=Ottoman)",
129129
Value: eth.DefaultConfig.NetworkId,
130130
}
131131
TestnetFlag = cli.BoolFlag{
@@ -136,6 +136,10 @@ var (
136136
Name: "rinkeby",
137137
Usage: "Rinkeby network: pre-configured proof-of-authority test network",
138138
}
139+
OttomanFlag = cli.BoolFlag{
140+
Name: "ottoman",
141+
Usage: "Ottoman network: pre-configured istanbul bft test network",
142+
}
139143
DevModeFlag = cli.BoolFlag{
140144
Name: "dev",
141145
Usage: "Developer mode: pre-configured private network with several debugging flags",
@@ -516,6 +520,9 @@ func MakeDataDir(ctx *cli.Context) string {
516520
if ctx.GlobalBool(RinkebyFlag.Name) {
517521
return filepath.Join(path, "rinkeby")
518522
}
523+
if ctx.GlobalBool(OttomanFlag.Name) {
524+
return filepath.Join(path, "ottoman")
525+
}
519526
return path
520527
}
521528
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
@@ -570,6 +577,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
570577
urls = params.TestnetBootnodes
571578
case ctx.GlobalBool(RinkebyFlag.Name):
572579
urls = params.RinkebyBootnodes
580+
case ctx.GlobalBool(OttomanFlag.Name):
581+
urls = params.OttomanBootnodes
573582
}
574583

575584
cfg.BootstrapNodes = make([]*discover.Node, 0, len(urls))
@@ -839,6 +848,8 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
839848
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
840849
case ctx.GlobalBool(RinkebyFlag.Name):
841850
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
851+
case ctx.GlobalBool(OttomanFlag.Name):
852+
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "ottoman")
842853
}
843854

844855
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
@@ -952,7 +963,7 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
952963
// SetEthConfig applies eth-related command line flags to the config.
953964
func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
954965
// Avoid conflicting network flags
955-
checkExclusive(ctx, DevModeFlag, TestnetFlag, RinkebyFlag)
966+
checkExclusive(ctx, DevModeFlag, TestnetFlag, RinkebyFlag, OttomanFlag)
956967
checkExclusive(ctx, FastSyncFlag, LightModeFlag, SyncModeFlag)
957968

958969
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
@@ -1018,6 +1029,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
10181029
cfg.NetworkId = 4
10191030
}
10201031
cfg.Genesis = core.DefaultRinkebyGenesisBlock()
1032+
case ctx.GlobalBool(OttomanFlag.Name):
1033+
if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
1034+
cfg.NetworkId = 5
1035+
}
1036+
cfg.Genesis = core.DefaultOttomanGenesisBlock()
10211037
case ctx.GlobalBool(DevModeFlag.Name):
10221038
cfg.Genesis = core.DevGenesisBlock()
10231039
if !ctx.GlobalIsSet(GasPriceFlag.Name) {
@@ -1110,6 +1126,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
11101126
genesis = core.DefaultTestnetGenesisBlock()
11111127
case ctx.GlobalBool(RinkebyFlag.Name):
11121128
genesis = core.DefaultRinkebyGenesisBlock()
1129+
case ctx.GlobalBool(OttomanFlag.Name):
1130+
genesis = core.DefaultOttomanGenesisBlock()
11131131
case ctx.GlobalBool(DevModeFlag.Name):
11141132
genesis = core.DevGenesisBlock()
11151133
}

core/genesis.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,19 @@ func DefaultRinkebyGenesisBlock() *Genesis {
342342
}
343343
}
344344

345+
// DefaultOttomanGenesisBlock returns the Ottoman network genesis block.
346+
func DefaultOttomanGenesisBlock() *Genesis {
347+
return &Genesis{
348+
Config: params.OttomanChainConfig,
349+
Timestamp: 1496993285,
350+
ExtraData: hexutil.MustDecode("0x0000000000000000000000000000000000000000000000000000000000000000f89af85494475cc98b5521ab2a1335683e7567c8048bfe79ed9407d8299de61faed3686ba4c4e6c3b9083d7e2371944fe035ce99af680d89e2c4d73aca01dbfc1bd2fd94dc421209441a754f79c4a4ecd2b49c935aad0312b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0"),
351+
GasLimit: 4700000,
352+
Difficulty: big.NewInt(1),
353+
Mixhash: common.HexToHash("0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365"),
354+
Alloc: decodePrealloc(ottomanAllocData),
355+
}
356+
}
357+
345358
// DevGenesisBlock returns the 'geth --dev' genesis block.
346359
func DevGenesisBlock() *Genesis {
347360
return &Genesis{

core/genesis_alloc.go

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

params/bootnodes.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ var RinkebyV5Bootnodes = []string{
5151
"enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303?discport=30304", // IE
5252
}
5353

54+
// Ottoman are the enode URLs of the P2P bootstrap nodes running on the
55+
// Ottoman test network.
56+
var OttomanBootnodes = []string{
57+
"enode://851ceb576681cf1e0d46ee9f049d6c678f229d806d1b41afe5b6d3c99a43fbbb7271d60e4c43cc5535e125a61db4ea2424823a3ad2c5959e8125f546cd1a7969@13.76.136.158:30303", //SG
58+
"enode://e3b5624752b86b60aa492edd65bdc906f9861a5e9113abd8f908443d1f64395c0e2bdd2e1825154837fd72da9d2e55e4f231411d5ca99ba9c90e14ba2f5612f6@52.163.118.231:30303", //SG
59+
"enode://3a1c96fe1fe9da5d4ea3b1a65bfecb4571101b519595cab6deb2eb029209353cdbc91c8d3751d0c6c00e5440657b678508e99bd9e934d4a0c1ad553fc1cb9155@13.76.140.250:30303", //SG
60+
"enode://aebe74e4ab7db8074d1cb9634dab3fd8c5745f8cc4868da2007ff754721085b189ffaf44b8041219de90b55df3ac515bbd0e1df7fde8d7684df0ecfb12534a73@52.187.45.126:30303", //SG
61+
}
62+
5463
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
5564
// experimental RLPx v5 topic-discovery network.
5665
var DiscoveryV5Bootnodes = []string{

params/config.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ var (
7878
},
7979
}
8080

81+
// OttomanChainConfig contains the chain parameters to run a node on the Ottoman test network.
82+
OttomanChainConfig = &ChainConfig{
83+
ChainId: big.NewInt(5),
84+
HomesteadBlock: big.NewInt(1),
85+
DAOForkBlock: nil,
86+
DAOForkSupport: true,
87+
EIP150Block: big.NewInt(2),
88+
EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
89+
EIP155Block: big.NewInt(3),
90+
EIP158Block: big.NewInt(3),
91+
MetropolisBlock: big.NewInt(math.MaxInt64), // Don't enable yet
92+
93+
Istanbul: &IstanbulConfig{
94+
Epoch: 30000,
95+
ProposerPolicy: 0,
96+
},
97+
}
98+
8199
// AllProtocolChanges contains every protocol change (EIPs)
82100
// introduced and accepted by the Ethereum core developers.
83101
//

0 commit comments

Comments
 (0)