code: func determineBlockHeights(blocksMap map[chainhash.Hash]*blockChainContext) error {
  	queue := list.New()
  
  	// The genesis block is included in blocksMap as a child of the zero hash
  	// because that is the value of the PrevBlock field in the genesis header.
  	preGenesisContext, exists := blocksMap[zeroHash]
  	if !exists || len(preGenesisContext.children) == 0 {
  		return fmt.Errorf("Unable to find genesis block")
  	}
  
  	for _, genesisHash := range preGenesisContext.children {
  		blocksMap[*genesisHash].height = 0
  		queue.PushBack(genesisHash)
  	}
  
  	for e := queue.Front(); e != nil; e = queue.Front() {
  		queue.Remove(e)
  		hash := e.Value.(*chainhash.Hash)
  		height := blocksMap[*hash].height
  
  		// For each block with this one as a parent, assign it a height and
  		// push to queue for future processing.
  		for _, childHash := range blocksMap[*hash].children {
  			blocksMap[*childHash].height = height + 1
  			queue.PushBack(childHash)
  		}
  	}
  
  	return nil
  }
docs: // determineBlockHeights takes a map of block hashes to a slice of child hashes
  // and uses it to compute the height for each block. The function assigns a
  // height of 0 to the genesis hash and explores the tree of blocks
  // breadth-first, assigning a height to every block with a path back to the
  // genesis block. This function modifies the height field on the blocksMap
  // entries.