@@ -847,61 +847,40 @@ func MakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *params.ChainCon
847847 (genesis .Hash () == params .MainNetGenesisHash && ! ctx .GlobalBool (TestNetFlag .Name )) ||
848848 (genesis .Hash () == params .TestNetGenesisHash && ctx .GlobalBool (TestNetFlag .Name ))
849849
850- // Set any missing chainConfig fields due to them being unset or system upgrade
851850 if defaults {
852- if config .HomesteadBlock == nil {
853- if ctx .GlobalBool (TestNetFlag .Name ) {
854- config .HomesteadBlock = params .TestNetHomesteadBlock
855- } else {
856- config .HomesteadBlock = params .MainNetHomesteadBlock
857- }
858- }
859- if config .DAOForkBlock == nil {
860- if ctx .GlobalBool (TestNetFlag .Name ) {
861- config .DAOForkBlock = params .TestNetDAOForkBlock
862- } else {
863- config .DAOForkBlock = params .MainNetDAOForkBlock
864- }
865- config .DAOForkSupport = true
866- }
867- if config .EIP150Block == nil {
868- if ctx .GlobalBool (TestNetFlag .Name ) {
869- config .EIP150Block = params .TestNetHomesteadGasRepriceBlock
870- } else {
871- config .EIP150Block = params .MainNetHomesteadGasRepriceBlock
872- }
873- }
874- if config .EIP150Hash == (common.Hash {}) {
875- if ctx .GlobalBool (TestNetFlag .Name ) {
876- config .EIP150Hash = params .TestNetHomesteadGasRepriceHash
877- } else {
878- config .EIP150Hash = params .MainNetHomesteadGasRepriceHash
879- }
851+ // Homestead fork
852+ if ctx .GlobalBool (TestNetFlag .Name ) {
853+ config .HomesteadBlock = params .TestNetHomesteadBlock
854+ } else {
855+ config .HomesteadBlock = params .MainNetHomesteadBlock
880856 }
881- if config .EIP155Block == nil {
882- if ctx .GlobalBool (TestNetFlag .Name ) {
883- config .EIP150Block = params .TestNetSpuriousDragon
884- } else {
885- config .EIP155Block = params .MainNetSpuriousDragon
886- }
857+ // DAO fork
858+ if ctx .GlobalBool (TestNetFlag .Name ) {
859+ config .DAOForkBlock = params .TestNetDAOForkBlock
860+ } else {
861+ config .DAOForkBlock = params .MainNetDAOForkBlock
887862 }
888- if config .EIP158Block == nil {
889- if ctx .GlobalBool (TestNetFlag .Name ) {
890- config .EIP158Block = params .TestNetSpuriousDragon
891- } else {
892- config .EIP158Block = params .MainNetSpuriousDragon
893- }
863+ config .DAOForkSupport = true
864+
865+ // DoS reprice fork
866+ if ctx .GlobalBool (TestNetFlag .Name ) {
867+ config .EIP150Block = params .TestNetHomesteadGasRepriceBlock
868+ config .EIP150Hash = params .TestNetHomesteadGasRepriceHash
869+ } else {
870+ config .EIP150Block = params .MainNetHomesteadGasRepriceBlock
871+ config .EIP150Hash = params .MainNetHomesteadGasRepriceHash
894872 }
895- if config .ChainId .BitLen () == 0 {
896- if ctx .GlobalBool (TestNetFlag .Name ) {
897- config .ChainId = params .TestNetChainID
898- } else {
899- config .ChainId = params .MainNetChainID
900- }
873+ // DoS state cleanup fork
874+ if ctx .GlobalBool (TestNetFlag .Name ) {
875+ config .EIP155Block = params .TestNetSpuriousDragon
876+ config .EIP158Block = params .TestNetSpuriousDragon
877+ config .ChainId = params .TestNetChainID
878+ } else {
879+ config .EIP155Block = params .MainNetSpuriousDragon
880+ config .EIP158Block = params .MainNetSpuriousDragon
881+ config .ChainId = params .MainNetChainID
901882 }
902- config .DAOForkSupport = true
903883 }
904-
905884 // Force override any existing configs if explicitly requested
906885 switch {
907886 case ctx .GlobalBool (SupportDAOFork .Name ):
0 commit comments