code: func (idx *TxIndex) ConnectBlock(dbTx database.Tx, block *btcutil.Block,
  	stxos []blockchain.SpentTxOut) error {
  
  	// Increment the internal block ID to use for the block being connected
  	// and add all of the transactions in the block to the index.
  	newBlockID := idx.curBlockID + 1
  	if err := dbAddTxIndexEntries(dbTx, block, newBlockID); err != nil {
  		return err
  	}
  
  	// Add the new block ID index entry for the block being connected and
  	// update the current internal block ID accordingly.
  	err := dbPutBlockIDIndexEntry(dbTx, block.Hash(), newBlockID)
  	if err != nil {
  		return err
  	}
  	idx.curBlockID = newBlockID
  	return nil
  }
docs: // ConnectBlock is invoked by the index manager when a new block has been
  // connected to the main chain.  This indexer adds a hash-to-transaction mapping
  // for every transaction in the passed block.
  //
  // This is part of the Indexer interface.