forked from cerc-io/plugeth
cmd, params: implement Gray Glacier hard-fork (EIP-5133) (#25088)
* cmd/geth, params: implement Gray Glacier (EIP-5133) * cmd/evm: add gray glacier tests * params: nitpicks * params: fixes
This commit is contained in:
@@ -45,6 +45,11 @@ var (
|
||||
maxUncles = 2 // Maximum number of uncles allowed in a single block
|
||||
allowedFutureBlockTimeSeconds = int64(15) // Max seconds from current time allowed for blocks, before they're considered future blocks
|
||||
|
||||
// calcDifficultyEip5133 is the difficulty adjustment algorithm as specified by EIP 5133.
|
||||
// It offsets the bomb a total of 11.4M blocks.
|
||||
// Specification EIP-5133: https://eips.ethereum.org/EIPS/eip-5133
|
||||
calcDifficultyEip5133 = makeDifficultyCalculator(big.NewInt(11_400_000))
|
||||
|
||||
// calcDifficultyEip4345 is the difficulty adjustment algorithm as specified by EIP 4345.
|
||||
// It offsets the bomb a total of 10.7M blocks.
|
||||
// Specification EIP-4345: https://eips.ethereum.org/EIPS/eip-4345
|
||||
@@ -334,6 +339,8 @@ func (ethash *Ethash) CalcDifficulty(chain consensus.ChainHeaderReader, time uin
|
||||
func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Header) *big.Int {
|
||||
next := new(big.Int).Add(parent.Number, big1)
|
||||
switch {
|
||||
case config.IsGrayGlacier(next):
|
||||
return calcDifficultyEip5133(time, parent)
|
||||
case config.IsArrowGlacier(next):
|
||||
return calcDifficultyEip4345(time, parent)
|
||||
case config.IsLondon(next):
|
||||
|
||||
Reference in New Issue
Block a user