code: func (mp *TxPool) removeTransaction(tx *btcutil.Tx, removeRedeemers bool) {
  	txHash := tx.Hash()
  	if removeRedeemers {
  		// Remove any transactions which rely on this one.
  		for i := uint32(0); i < uint32(len(tx.MsgTx().TxOut)); i++ {
  			prevOut := wire.OutPoint{Hash: *txHash, Index: i}
  			if txRedeemer, exists := mp.outpoints[prevOut]; exists {
  				mp.removeTransaction(txRedeemer, true)
  			}
  		}
  	}
  
  	// Remove the transaction if needed.
  	if txDesc, exists := mp.pool[*txHash]; exists {
  		// Remove unconfirmed address index entries associated with the
  		// transaction if enabled.
  		if mp.cfg.AddrIndex != nil {
  			mp.cfg.AddrIndex.RemoveUnconfirmedTx(txHash)
  		}
  
  		// Mark the referenced outpoints as unspent by the pool.
  		for _, txIn := range txDesc.Tx.MsgTx().TxIn {
  			delete(mp.outpoints, txIn.PreviousOutPoint)
  		}
  		delete(mp.pool, *txHash)
  		atomic.StoreInt64(&mp.lastUpdated, time.Now().Unix())
  	}
  }
docs: // removeTransaction is the internal function which implements the public
  // RemoveTransaction.  See the comment for RemoveTransaction for more details.
  //
  // This function MUST be called with the mempool lock held (for writes).