code: func GetHashFn(ref *types.Header, chain ChainContext) func(n uint64) common.Hash {
  	var cache map[uint64]common.Hash
  
  	return func(n uint64) common.Hash {
  		// If there's no hash cache yet, make one
  		if cache == nil {
  			cache = map[uint64]common.Hash{
  				ref.Number.Uint64() - 1: ref.ParentHash,
  			}
  		}
  		// Try to fulfill the request from the cache
  		if hash, ok := cache[n]; ok {
  			return hash
  		}
  		// Not cached, iterate the blocks and cache the hashes
  		for header := chain.GetHeader(ref.ParentHash, ref.Number.Uint64()-1); header != nil; header = chain.GetHeader(header.ParentHash, header.Number.Uint64()-1) {
  			cache[header.Number.Uint64()-1] = header.ParentHash
  			if n == header.Number.Uint64()-1 {
  				return header.ParentHash
  			}
  		}
  		return common.Hash{}
  	}
  }
docs: // GetHashFn returns a GetHashFunc which retrieves header hashes by number