code: func (b *BlockChain) locateHeaders(locator BlockLocator, hashStop *chainhash.Hash, maxHeaders uint32) []wire.BlockHeader {
  	// Find the node after the first known block in the locator and the
  	// total number of nodes after it needed while respecting the stop hash
  	// and max entries.
  	node, total := b.locateInventory(locator, hashStop, maxHeaders)
  	if total == 0 {
  		return nil
  	}
  
  	// Populate and return the found headers.
  	headers := make([]wire.BlockHeader, 0, total)
  	for i := uint32(0); i < total; i++ {
  		headers = append(headers, node.Header())
  		node = b.bestChain.Next(node)
  	}
  	return headers
  }
docs: // locateHeaders returns the headers of the blocks after the first known block
  // in the locator until the provided stop hash is reached, or up to the provided
  // max number of block headers.
  //
  // See the comment on the exported function for more details on special cases.
  //
  // This function MUST be called with the chain state lock held (for reads).