code: func dbAddTxIndexEntries(dbTx database.Tx, block *btcutil.Block, blockID uint32) error {
  	// The offset and length of the transactions within the serialized
  	// block.
  	txLocs, err := block.TxLoc()
  	if err != nil {
  		return err
  	}
  
  	// As an optimization, allocate a single slice big enough to hold all
  	// of the serialized transaction index entries for the block and
  	// serialize them directly into the slice.  Then, pass the appropriate
  	// subslice to the database to be written.  This approach significantly
  	// cuts down on the number of required allocations.
  	offset := 0
  	serializedValues := make([]byte, len(block.Transactions())*txEntrySize)
  	for i, tx := range block.Transactions() {
  		putTxIndexEntry(serializedValues[offset:], blockID, txLocs[i])
  		endOffset := offset + txEntrySize
  		err := dbPutTxIndexEntry(dbTx, tx.Hash(),
  			serializedValues[offset:endOffset:endOffset])
  		if err != nil {
  			return err
  		}
  		offset += txEntrySize
  	}
  
  	return nil
  }
docs: // dbAddTxIndexEntries uses an existing database transaction to add a
  // transaction index entry for every transaction in the passed block.