code: func dbPutBlockIndex(dbTx database.Tx, hash *chainhash.Hash, height int32) error {
  	// Serialize the height for use in the index entries.
  	var serializedHeight [4]byte
  	byteOrder.PutUint32(serializedHeight[:], uint32(height))
  
  	// Add the block hash to height mapping to the index.
  	meta := dbTx.Metadata()
  	hashIndex := meta.Bucket(hashIndexBucketName)
  	if err := hashIndex.Put(hash[:], serializedHeight[:]); err != nil {
  		return err
  	}
  
  	// Add the block height to hash mapping to the index.
  	heightIndex := meta.Bucket(heightIndexBucketName)
  	return heightIndex.Put(serializedHeight[:], hash[:])
  }
docs: // -----------------------------------------------------------------------------
  // The block index consists of two buckets with an entry for every block in the
  // main chain.  One bucket is for the hash to height mapping and the other is
  // for the height to hash mapping.
  //
  // The serialized format for values in the hash to height bucket is:
  //   <height>
  //
  //   Field      Type     Size
  //   height     uint32   4 bytes
  //
  // The serialized format for values in the height to hash bucket is:
  //   <hash>
  //
  //   Field      Type             Size
  //   hash       chainhash.Hash   chainhash.HashSize
  // -----------------------------------------------------------------------------
  // dbPutBlockIndex uses an existing database transaction to update or add the
  // block index entries for the hash to height and height to hash mappings for
  // the provided values.