consensus/ethash: implement faster difficulty calculators (#21976)
This PR adds re-written difficulty calculators, which are based on uint256. It also adds a fuzzer + oss-fuzz integration for the new fuzzer. It does differential fuzzing between the new and old calculators. Note: this PR does not actually enable the new calculators.
This commit is contained in:
committed by
GitHub
parent
88c696240d
commit
efe6dd2904
@@ -485,6 +485,11 @@ func calcDifficultyFrontier(time uint64, parent *types.Header) *big.Int {
|
||||
return diff
|
||||
}
|
||||
|
||||
// Exported for fuzzing
|
||||
var FrontierDifficultyCalulator = calcDifficultyFrontier
|
||||
var HomesteadDifficultyCalulator = calcDifficultyHomestead
|
||||
var DynamicDifficultyCalculator = makeDifficultyCalculator
|
||||
|
||||
// VerifySeal implements consensus.Engine, checking whether the given block satisfies
|
||||
// the PoW difficulty requirements.
|
||||
func (ethash *Ethash) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error {
|
||||
|
Reference in New Issue
Block a user