code: func (b *BlockChain) BlockHeightByHash(hash *chainhash.Hash) (int32, error) {
  	node := b.index.LookupNode(hash)
  	if node == nil || !b.bestChain.Contains(node) {
  		str := fmt.Sprintf("block %s is not in the main chain", hash)
  		return 0, errNotInMainChain(str)
  	}
  
  	return node.height, nil
  }
docs: // BlockHeightByHash returns the height of the block with the given hash in the
  // main chain.
  //
  // This function is safe for concurrent access.