mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
appease linter
This commit is contained in:
parent
ca2e9775ca
commit
057468beff
2 changed files with 17 additions and 15 deletions
|
|
@ -1646,38 +1646,40 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validateDeveloperGenesis asserts that a provided genesis can be used with dev mode:
|
||||||
|
// it requires pre-merge hard-forks and proof-of-stake to be activated at block 0
|
||||||
func validateDeveloperGenesis(genesis *core.Genesis) error {
|
func validateDeveloperGenesis(genesis *core.Genesis) error {
|
||||||
checkHFIsZero := func(forkName string, hfBlockNumber *big.Int) error {
|
checkForkIsBlock0 := func(forkName string, hfBlockNumber *big.Int) error {
|
||||||
if hfBlockNumber == nil {
|
if hfBlockNumber == nil {
|
||||||
return errors.New(fmt.Sprintf("%s: hard-fork not enabled", forkName))
|
return fmt.Errorf("%s: hard-fork not enabled", forkName)
|
||||||
} else if hfBlockNumber.Cmp(big.NewInt(0)) != 0 {
|
} else if hfBlockNumber.Cmp(big.NewInt(0)) != 0 {
|
||||||
return errors.New(fmt.Sprintf("%s: hard-fork not activated in block 0", forkName))
|
return fmt.Errorf("%s: hard-fork not activated in block 0", forkName)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
config := genesis.Config
|
config := genesis.Config
|
||||||
if err := checkHFIsZero("Homestead", config.HomesteadBlock); err != nil {
|
if err := checkForkIsBlock0("Homestead", config.HomesteadBlock); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if config.DAOForkBlock != nil {
|
} else if config.DAOForkBlock != nil {
|
||||||
return errors.New("DAO hardfork cannot be enabled")
|
return errors.New("DAO hardfork cannot be enabled")
|
||||||
} else if err := checkHFIsZero("EIP150", config.EIP150Block); err != nil {
|
} else if err := checkForkIsBlock0("EIP150", config.EIP150Block); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("EIP155", config.EIP155Block); err != nil {
|
} else if err := checkForkIsBlock0("EIP155", config.EIP155Block); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("EIP158", config.EIP158Block); err != nil {
|
} else if err := checkForkIsBlock0("EIP158", config.EIP158Block); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("Byzantium", config.ByzantiumBlock); err != nil {
|
} else if err := checkForkIsBlock0("Byzantium", config.ByzantiumBlock); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("Constantinople", config.ConstantinopleBlock); err != nil {
|
} else if err := checkForkIsBlock0("Constantinople", config.ConstantinopleBlock); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("Istanbul", config.IstanbulBlock); err != nil {
|
} else if err := checkForkIsBlock0("Istanbul", config.IstanbulBlock); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("Berlin", config.BerlinBlock); err != nil {
|
} else if err := checkForkIsBlock0("Berlin", config.BerlinBlock); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err := checkHFIsZero("London", config.LondonBlock); err != nil {
|
} else if err := checkForkIsBlock0("London", config.LondonBlock); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if config.TerminalTotalDifficultyPassed != true {
|
} else if !config.TerminalTotalDifficultyPassed {
|
||||||
return errors.New("terminal total difficulty must be passed")
|
return errors.New("terminal total difficulty must be passed")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -328,8 +328,8 @@ type ChainConfig struct {
|
||||||
TerminalTotalDifficultyPassed bool `json:"terminalTotalDifficultyPassed,omitempty"`
|
TerminalTotalDifficultyPassed bool `json:"terminalTotalDifficultyPassed,omitempty"`
|
||||||
|
|
||||||
// Various consensus engines
|
// Various consensus engines
|
||||||
Ethash *EthashConfig `json:"ethash,omitempty"`
|
Ethash *EthashConfig `json:"ethash,omitempty"`
|
||||||
Clique *CliqueConfig `json:"clique,omitempty"`
|
Clique *CliqueConfig `json:"clique,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue