code: func (mp *TxPool) removeOrphan(tx *btcutil.Tx, removeRedeemers bool) {
  	// Nothing to do if passed tx is not an orphan.
  	txHash := tx.Hash()
  	otx, exists := mp.orphans[*txHash]
  	if !exists {
  		return
  	}
  
  	// Remove the reference from the previous orphan index.
  	for _, txIn := range otx.tx.MsgTx().TxIn {
  		orphans, exists := mp.orphansByPrev[txIn.PreviousOutPoint]
  		if exists {
  			delete(orphans, *txHash)
  
  			// Remove the map entry altogether if there are no
  			// longer any orphans which depend on it.
  			if len(orphans) == 0 {
  				delete(mp.orphansByPrev, txIn.PreviousOutPoint)
  			}
  		}
  	}
  
  	// Remove any orphans that redeem outputs from this one if requested.
  	if removeRedeemers {
  		prevOut := wire.OutPoint{Hash: *txHash}
  		for txOutIdx := range tx.MsgTx().TxOut {
  			prevOut.Index = uint32(txOutIdx)
  			for _, orphan := range mp.orphansByPrev[prevOut] {
  				mp.removeOrphan(orphan, true)
  			}
  		}
  	}
  
  	// Remove the transaction from the orphan pool.
  	delete(mp.orphans, *txHash)
  }
docs: // removeOrphan is the internal function which implements the public
  // RemoveOrphan.  See the comment for RemoveOrphan for more details.
  //
  // This function MUST be called with the mempool lock held (for writes).