@@ -71,16 +71,6 @@ func New(ethone consensus.Engine) *Beacon {
7171 return & Beacon {ethone : ethone }
7272}
7373
74- // isPostMerge reports whether the given block number is assumed to be post-merge.
75- // Here we check the MergeNetsplitBlock to allow configuring networks with a PoW or
76- // PoA chain for unit testing purposes.
77- func isPostMerge (config * params.ChainConfig , blockNum uint64 , timestamp uint64 ) bool {
78- mergedAtGenesis := config .TerminalTotalDifficulty != nil && config .TerminalTotalDifficulty .Sign () == 0
79- return mergedAtGenesis ||
80- config .MergeNetsplitBlock != nil && blockNum >= config .MergeNetsplitBlock .Uint64 () ||
81- config .ShanghaiTime != nil && timestamp >= * config .ShanghaiTime
82- }
83-
8474// Author implements consensus.Engine, returning the verified author of the block.
8575func (beacon * Beacon ) Author (header * types.Header ) (common.Address , error ) {
8676 if ! beacon .IsPoSHeader (header ) {
@@ -328,7 +318,7 @@ func (beacon *Beacon) verifyHeaders(chain consensus.ChainHeaderReader, headers [
328318// Prepare implements consensus.Engine, initializing the difficulty field of a
329319// header to conform to the beacon protocol. The changes are done inline.
330320func (beacon * Beacon ) Prepare (chain consensus.ChainHeaderReader , header * types.Header ) error {
331- if ! isPostMerge ( chain .Config (), header .Number .Uint64 (), header .Time ) {
321+ if ! chain .Config (). IsPostMerge ( header .Number .Uint64 (), header .Time ) {
332322 return beacon .ethone .Prepare (chain , header )
333323 }
334324 header .Difficulty = beaconDifficulty
@@ -442,7 +432,7 @@ func (beacon *Beacon) SealHash(header *types.Header) common.Hash {
442432// the difficulty that a new block should have when created at time
443433// given the parent block's time and difficulty.
444434func (beacon * Beacon ) CalcDifficulty (chain consensus.ChainHeaderReader , time uint64 , parent * types.Header ) * big.Int {
445- if ! isPostMerge ( chain .Config (), parent .Number .Uint64 ()+ 1 , time ) {
435+ if ! chain .Config (). IsPostMerge ( parent .Number .Uint64 ()+ 1 , time ) {
446436 return beacon .ethone .CalcDifficulty (chain , time , parent )
447437 }
448438 return beaconDifficulty
0 commit comments