code: func (mp *TxPool) checkPoolDoubleSpend(tx *btcutil.Tx) error {
  	for _, txIn := range tx.MsgTx().TxIn {
  		if txR, exists := mp.outpoints[txIn.PreviousOutPoint]; exists {
  			str := fmt.Sprintf("output %v already spent by "+
  				"transaction %v in the memory pool",
  				txIn.PreviousOutPoint, txR.Hash())
  			return txRuleError(wire.RejectDuplicate, str)
  		}
  	}
  
  	return nil
  }
docs: // checkPoolDoubleSpend checks whether or not the passed transaction is
  // attempting to spend coins already spent by other transactions in the pool.
  // Note it does not check for double spends against transactions already in the
  // main chain.
  //
  // This function MUST be called with the mempool lock held (for reads).