code: func NewHeaderChain(chainDb ethdb.Database, config *params.ChainConfig, engine consensus.Engine, procInterrupt func() bool) (*HeaderChain, error) {
  	headerCache, _ := lru.New(headerCacheLimit)
  	tdCache, _ := lru.New(tdCacheLimit)
  	numberCache, _ := lru.New(numberCacheLimit)
  
  	// Seed a fast but crypto originating random generator
  	seed, err := crand.Int(crand.Reader, big.NewInt(math.MaxInt64))
  	if err != nil {
  		return nil, err
  	}
  
  	hc := &HeaderChain{
  		config:        config,
  		chainDb:       chainDb,
  		headerCache:   headerCache,
  		tdCache:       tdCache,
  		numberCache:   numberCache,
  		procInterrupt: procInterrupt,
  		rand:          mrand.New(mrand.NewSource(seed.Int64())),
  		engine:        engine,
  	}
  
  	hc.genesisHeader = hc.GetHeaderByNumber(0)
  	if hc.genesisHeader == nil {
  		return nil, ErrNoGenesis
  	}
  
  	hc.currentHeader.Store(hc.genesisHeader)
  	if head := rawdb.ReadHeadBlockHash(chainDb); head != (common.Hash{}) {
  		if chead := hc.GetHeaderByHash(head); chead != nil {
  			hc.currentHeader.Store(chead)
  		}
  	}
  	hc.currentHeaderHash = hc.CurrentHeader().Hash()
  
  	return hc, nil
  }
docs: // NewHeaderChain creates a new HeaderChain structure.
  //  getValidator should return the parent's validator
  //  procInterrupt points to the parent's interrupt semaphore
  //  wg points to the parent's shutdown wait group