Skip to content

Commit c7e4e89

Browse files
committed
consensus/beacon: clarify isPreMerge
1 parent 0e4c13a commit c7e4e89

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

consensus/beacon/consensus.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ func New(ethone consensus.Engine) *Beacon {
7272
return &Beacon{ethone: ethone}
7373
}
7474

75+
// isPreMerge reports whether the given block number is assumed to be pre-merge.
76+
// Here we check the MergeNetsplitBlock to allow configuring networks with a PoW or
77+
// PoA chain for unit testing purposes.
7578
func isPreMerge(config *params.ChainConfig, block uint64) bool {
76-
return !(config.TerminalTotalDifficulty != nil && config.TerminalTotalDifficulty.Sign() == 0) ||
77-
(config.MergeNetsplitBlock != nil && block < config.MergeNetsplitBlock.Uint64())
79+
mergedAtGenesis := config.TerminalTotalDifficulty != nil && config.TerminalTotalDifficulty.Sign() == 0
80+
return !mergedAtGenesis && config.MergeNetsplitBlock != nil && block < config.MergeNetsplitBlock.Uint64()
7881
}
7982

8083
// Author implements consensus.Engine, returning the verified author of the block.

0 commit comments

Comments
 (0)