code: func CalcDifficulty(config *params.ChainConfig, time uint64, parent *types.Header) *big.Int {
  	next := new(big.Int).Add(parent.Number, big1)
  	switch {
  	case config.IsConstantinople(next):
  		return calcDifficultyConstantinople(time, parent)
  	case config.IsByzantium(next):
  		return calcDifficultyByzantium(time, parent)
  	case config.IsHomestead(next):
  		return calcDifficultyHomestead(time, parent)
  	default:
  		return calcDifficultyFrontier(time, parent)
  	}
  }
docs: // CalcDifficulty is the difficulty adjustment algorithm. It returns
  // the difficulty that a new block should have when created at time
  // given the parent block's time and difficulty.