aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-11-16 07:46:40 +0800
committerFelix Lange <fjl@twurst.com>2016-11-16 07:46:40 +0800
commit64359c9417244c7a824ea90b39a20b06f702bc08 (patch)
treeeb0618e0afbbf7364884d1ce9ce23266fc56de94 /cmd/utils/flags.go
parent5a3853f83f931b6a68353cb1f3611f1db345e340 (diff)
downloadgo-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.tar
go-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.tar.gz
go-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.tar.bz2
go-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.tar.lz
go-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.tar.xz
go-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.tar.zst
go-tangerine-64359c9417244c7a824ea90b39a20b06f702bc08.zip
cmd/utils, mobile, params: set the correct field on testnet EIP 155 (#3272)
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go77
1 files changed, 28 insertions, 49 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index cac8773e2..dd18fd78c 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -847,61 +847,40 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon
(genesis.Hash() == params.MainNetGenesisHash && !ctx.GlobalBool(TestNetFlag.Name)) ||
(genesis.Hash() == params.TestNetGenesisHash && ctx.GlobalBool(TestNetFlag.Name))
- // Set any missing chainConfig fields due to them being unset or system upgrade
if defaults {
- if config.HomesteadBlock == nil {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.HomesteadBlock = params.TestNetHomesteadBlock
- } else {
- config.HomesteadBlock = params.MainNetHomesteadBlock
- }
- }
- if config.DAOForkBlock == nil {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.DAOForkBlock = params.TestNetDAOForkBlock
- } else {
- config.DAOForkBlock = params.MainNetDAOForkBlock
- }
- config.DAOForkSupport = true
- }
- if config.EIP150Block == nil {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.EIP150Block = params.TestNetHomesteadGasRepriceBlock
- } else {
- config.EIP150Block = params.MainNetHomesteadGasRepriceBlock
- }
- }
- if config.EIP150Hash == (common.Hash{}) {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.EIP150Hash = params.TestNetHomesteadGasRepriceHash
- } else {
- config.EIP150Hash = params.MainNetHomesteadGasRepriceHash
- }
+ // Homestead fork
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ config.HomesteadBlock = params.TestNetHomesteadBlock
+ } else {
+ config.HomesteadBlock = params.MainNetHomesteadBlock
}
- if config.EIP155Block == nil {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.EIP150Block = params.TestNetSpuriousDragon
- } else {
- config.EIP155Block = params.MainNetSpuriousDragon
- }
+ // DAO fork
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ config.DAOForkBlock = params.TestNetDAOForkBlock
+ } else {
+ config.DAOForkBlock = params.MainNetDAOForkBlock
}
- if config.EIP158Block == nil {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.EIP158Block = params.TestNetSpuriousDragon
- } else {
- config.EIP158Block = params.MainNetSpuriousDragon
- }
+ config.DAOForkSupport = true
+
+ // DoS reprice fork
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ config.EIP150Block = params.TestNetHomesteadGasRepriceBlock
+ config.EIP150Hash = params.TestNetHomesteadGasRepriceHash
+ } else {
+ config.EIP150Block = params.MainNetHomesteadGasRepriceBlock
+ config.EIP150Hash = params.MainNetHomesteadGasRepriceHash
}
- if config.ChainId.BitLen() == 0 {
- if ctx.GlobalBool(TestNetFlag.Name) {
- config.ChainId = params.TestNetChainID
- } else {
- config.ChainId = params.MainNetChainID
- }
+ // DoS state cleanup fork
+ if ctx.GlobalBool(TestNetFlag.Name) {
+ config.EIP155Block = params.TestNetSpuriousDragon
+ config.EIP158Block = params.TestNetSpuriousDragon
+ config.ChainId = params.TestNetChainID
+ } else {
+ config.EIP155Block = params.MainNetSpuriousDragon
+ config.EIP158Block = params.MainNetSpuriousDragon
+ config.ChainId = params.MainNetChainID
}
- config.DAOForkSupport = true
}
-
// Force override any existing configs if explicitly requested
switch {
case ctx.GlobalBool(SupportDAOFork.Name):