diff --git a/core/block_validator.go b/core/block_validator.go index 75f881db1..da1ae917e 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -314,7 +314,6 @@ func CalcDifficulty(config *ChainConfig, time uint64, parent *types.Header) *big // Some weird constants to avoid constant memory allocs for them. var ( - expDiffPeriod = big.NewInt(100000) big1 = big.NewInt(1) big2 = big.NewInt(2) big9 = big.NewInt(9) @@ -323,7 +322,6 @@ var ( ) func calcDifficultyAtlantis(time uint64, parent *types.Header) *big.Int { - bombDelayFromParent := new(big.Int).Sub(big.NewInt(3000000), big1) // https://github.com/ethereum/EIPs/issues/100. // algorithm: // diff = (parent_diff + @@ -358,23 +356,6 @@ func calcDifficultyAtlantis(time uint64, parent *types.Header) *big.Int { if x.Cmp(params.MinimumDifficulty) < 0 { x.Set(params.MinimumDifficulty) } - // calculate a fake block number for the ice-age delay - // Specification: https://eips.ethereum.org/EIPS/eip-1234 - fakeBlockNumber := new(big.Int) - if parent.Number.Cmp(bombDelayFromParent) >= 0 { - fakeBlockNumber = fakeBlockNumber.Sub(parent.Number, bombDelayFromParent) - } - // for the exponential factor - periodCount := fakeBlockNumber - periodCount.Div(periodCount, expDiffPeriod) - - // the exponential factor, commonly referred to as "the bomb" - // diff = diff + 2^(periodCount - 2) - if periodCount.Cmp(big1) > 0 { - y.Sub(periodCount, big2) - y.Exp(big2, y, nil) - x.Add(x, y) - } return x } diff --git a/tests/difficulty_test_util.go b/tests/difficulty_test_util.go index 7b8711231..8a6e52c1d 100644 --- a/tests/difficulty_test_util.go +++ b/tests/difficulty_test_util.go @@ -52,6 +52,10 @@ func (test *DifficultyTest) runDifficulty(t *testing.T, config *core.ChainConfig UncleHash: test.UncleHash, } + if config.IsAtlantis(parentNumber) && parent.Number.Cmp(big.NewInt(3199999)) >= 0 { + return nil + } + // Check to make sure difficulty is above minimum if parentDifficulty.Cmp(params.MinimumDifficulty) < 0 { t.Skip("difficulty below minimum")