code: func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainConfig, config *ethash.Config, notify []string, noverify bool, db ethdb.Database) consensus.Engine {
  	// If proof-of-authority is requested, set it up
  	if chainConfig.Clique != nil {
  		return clique.New(chainConfig.Clique, db)
  	}
  	// Otherwise assume proof-of-work
  	switch config.PowMode {
  	case ethash.ModeFake:
  		log.Warn("Ethash used in fake mode")
  		return ethash.NewFaker()
  	case ethash.ModeTest:
  		log.Warn("Ethash used in test mode")
  		return ethash.NewTester(nil, noverify)
  	case ethash.ModeShared:
  		log.Warn("Ethash used in shared mode")
  		return ethash.NewShared()
  	default:
  		engine := ethash.New(ethash.Config{
  			CacheDir:       ctx.ResolvePath(config.CacheDir),
  			CachesInMem:    config.CachesInMem,
  			CachesOnDisk:   config.CachesOnDisk,
  			DatasetDir:     config.DatasetDir,
  			DatasetsInMem:  config.DatasetsInMem,
  			DatasetsOnDisk: config.DatasetsOnDisk,
  		}, notify, noverify)
  		engine.SetThreads(-1) // Disable CPU mining
  		return engine
  	}
  }
docs: // CreateConsensusEngine creates the required type of consensus engine instance for an Ethereum service