all: define Berlin hard fork spec

This commit is contained in:
Péter Szilágyi
2021-02-25 09:10:30 +02:00
parent dc109cce26
commit 0928562670
22 changed files with 132 additions and 93 deletions

View File

@ -153,6 +153,10 @@ func (e *GenesisMismatchError) Error() string {
//
// The returned chain configuration is never nil.
func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, common.Hash, error) {
return SetupGenesisBlockWithOverride(db, genesis, nil)
}
func SetupGenesisBlockWithOverride(db ethdb.Database, genesis *Genesis, overrideBerlin *big.Int) (*params.ChainConfig, common.Hash, error) {
if genesis != nil && genesis.Config == nil {
return params.AllEthashProtocolChanges, common.Hash{}, errGenesisNoConfig
}
@ -198,6 +202,9 @@ func SetupGenesisBlock(db ethdb.Database, genesis *Genesis) (*params.ChainConfig
}
// Get the existing chain configuration.
newcfg := genesis.configOrDefault(stored)
if overrideBerlin != nil {
newcfg.BerlinBlock = overrideBerlin
}
if err := newcfg.CheckConfigForkOrder(); err != nil {
return newcfg, common.Hash{}, err
}