code: func (mp *TxPool) addTransaction(utxoView *blockchain.UtxoViewpoint, tx *btcutil.Tx, height int32, fee int64) *TxDesc {
  	// Add the transaction to the pool and mark the referenced outpoints
  	// as spent by the pool.
  	txD := &TxDesc{
  		TxDesc: mining.TxDesc{
  			Tx:       tx,
  			Added:    time.Now(),
  			Height:   height,
  			Fee:      fee,
  			FeePerKB: fee * 1000 / GetTxVirtualSize(tx),
  		},
  		StartingPriority: mining.CalcPriority(tx.MsgTx(), utxoView, height),
  	}
  
  	mp.pool[*tx.Hash()] = txD
  	for _, txIn := range tx.MsgTx().TxIn {
  		mp.outpoints[txIn.PreviousOutPoint] = tx
  	}
  	atomic.StoreInt64(&mp.lastUpdated, time.Now().Unix())
  
  	// Add unconfirmed address index entries associated with the transaction
  	// if enabled.
  	if mp.cfg.AddrIndex != nil {
  		mp.cfg.AddrIndex.AddUnconfirmedTx(tx, utxoView)
  	}
  
  	// Record this tx for fee estimation if enabled.
  	if mp.cfg.FeeEstimator != nil {
  		mp.cfg.FeeEstimator.ObserveTransaction(txD)
  	}
  
  	return txD
  }
docs: // addTransaction adds the passed transaction to the memory pool.  It should
  // not be called directly as it doesn't perform any validation.  This is a
  // helper for maybeAcceptTransaction.
  //
  // This function MUST be called with the mempool lock held (for writes).