code: func (mp *TxPool) RemoveDoubleSpends(tx *btcutil.Tx) {
  	// Protect concurrent access.
  	mp.mtx.Lock()
  	for _, txIn := range tx.MsgTx().TxIn {
  		if txRedeemer, ok := mp.outpoints[txIn.PreviousOutPoint]; ok {
  			if !txRedeemer.Hash().IsEqual(tx.Hash()) {
  				mp.removeTransaction(txRedeemer, true)
  			}
  		}
  	}
  	mp.mtx.Unlock()
  }
docs: // RemoveDoubleSpends removes all transactions which spend outputs spent by the
  // passed transaction from the memory pool.  Removing those transactions then
  // leads to removing all transactions which rely on them, recursively.  This is
  // necessary when a block is connected to the main chain because the block may
  // contain transactions which were previously unknown to the memory pool.
  //
  // This function is safe for concurrent access.