code: func (hc *HeaderChain) InsertHeaderChain(chain []*types.Header, writeHeader WhCallback, start time.Time) (int, error) {
  	// Collect some import statistics to report on
  	stats := struct{ processed, ignored int }{}
  	// All headers passed verification, import them into the database
  	for i, header := range chain {
  		// Short circuit insertion if shutting down
  		if hc.procInterrupt() {
  			log.Debug("Premature abort during headers import")
  			return i, errors.New("aborted")
  		}
  		// If the header's already known, skip it, otherwise store
  		if hc.HasHeader(header.Hash(), header.Number.Uint64()) {
  			stats.ignored++
  			continue
  		}
  		if err := writeHeader(header); err != nil {
  			return i, err
  		}
  		stats.processed++
  	}
  	// Report some public statistics so the user has a clue what's going on
  	last := chain[len(chain)-1]
  
  	context := []interface{}{
  		"count", stats.processed, "elapsed", common.PrettyDuration(time.Since(start)),
  		"number", last.Number, "hash", last.Hash(),
  	}
  	if timestamp := time.Unix(int64(last.Time), 0); time.Since(timestamp) > time.Minute {
  		context = append(context, []interface{}{"age", common.PrettyAge(timestamp)}...)
  	}
  	if stats.ignored > 0 {
  		context = append(context, []interface{}{"ignored", stats.ignored}...)
  	}
  	log.Info("Imported new block headers", context...)
  
  	return 0, nil
  }
docs: // InsertHeaderChain attempts to insert the given header chain in to the local
  // chain, possibly creating a reorg. If an error is returned, it will return the
  // index number of the failing header as well an error describing what went wrong.
  //
  // The verify parameter can be used to fine tune whether nonce verification
  // should be done or not. The reason behind the optional check is because some
  // of the header retrieval mechanisms already need to verfy nonces, as well as
  // because nonces can be verified sparsely, not needing to check each.