@@ -769,17 +769,17 @@ func SetupNetwork(ctx *cli.Context) {
769
769
}
770
770
771
771
// MustMakeChainConfig reads the chain configuration from the database in ctx.Datadir.
772
- func MustMakeChainConfig (ctx * cli.Context ) * core .ChainConfig {
772
+ func MustMakeChainConfig (ctx * cli.Context ) * params .ChainConfig {
773
773
db := MakeChainDatabase (ctx )
774
774
defer db .Close ()
775
775
776
776
return MustMakeChainConfigFromDb (ctx , db )
777
777
}
778
778
779
779
// MustMakeChainConfigFromDb reads the chain configuration from the given database.
780
- func MustMakeChainConfigFromDb (ctx * cli.Context , db ethdb.Database ) * core .ChainConfig {
780
+ func MustMakeChainConfigFromDb (ctx * cli.Context , db ethdb.Database ) * params .ChainConfig {
781
781
// If the chain is already initialized, use any existing chain configs
782
- config := new (core .ChainConfig )
782
+ config := new (params .ChainConfig )
783
783
784
784
genesis := core .GetBlock (db , core .GetCanonicalHash (db , 0 ))
785
785
if genesis != nil {
@@ -793,6 +793,9 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
793
793
Fatalf ("Could not make chain configuration: %v" , err )
794
794
}
795
795
}
796
+ if config .ChainId == nil {
797
+ config .ChainId = new (big.Int )
798
+ }
796
799
// Set any missing fields due to them being unset or system upgrade
797
800
if config .HomesteadBlock == nil {
798
801
if ctx .GlobalBool (TestNetFlag .Name ) {
@@ -809,11 +812,39 @@ func MustMakeChainConfigFromDb(ctx *cli.Context, db ethdb.Database) *core.ChainC
809
812
}
810
813
config .DAOForkSupport = true
811
814
}
812
- if config .HomesteadGasRepriceBlock == nil {
815
+ if config .EIP150Block == nil {
816
+ if ctx .GlobalBool (TestNetFlag .Name ) {
817
+ config .EIP150Block = params .TestNetHomesteadGasRepriceBlock
818
+ } else {
819
+ config .EIP150Block = params .MainNetHomesteadGasRepriceBlock
820
+ }
821
+ }
822
+ if config .EIP150Hash == (common.Hash {}) {
823
+ if ctx .GlobalBool (TestNetFlag .Name ) {
824
+ config .EIP150Hash = params .TestNetHomesteadGasRepriceHash
825
+ } else {
826
+ config .EIP150Hash = params .MainNetHomesteadGasRepriceHash
827
+ }
828
+ }
829
+ if config .EIP155Block == nil {
830
+ if ctx .GlobalBool (TestNetFlag .Name ) {
831
+ config .EIP150Block = params .TestNetSpuriousDragon
832
+ } else {
833
+ config .EIP155Block = params .MainNetSpuriousDragon
834
+ }
835
+ }
836
+ if config .EIP158Block == nil {
837
+ if ctx .GlobalBool (TestNetFlag .Name ) {
838
+ config .EIP158Block = params .TestNetSpuriousDragon
839
+ } else {
840
+ config .EIP158Block = params .MainNetSpuriousDragon
841
+ }
842
+ }
843
+ if config .ChainId .BitLen () == 0 {
813
844
if ctx .GlobalBool (TestNetFlag .Name ) {
814
- config .HomesteadGasRepriceBlock = params .TestNetHomesteadGasRepriceBlock
845
+ config .ChainId = params .TestNetChainID
815
846
} else {
816
- config .HomesteadGasRepriceBlock = params .MainNetHomesteadGasRepriceBlock
847
+ config .ChainId = params .MainNetChainID
817
848
}
818
849
}
819
850
// Force override any existing configs if explicitly requested
0 commit comments