code: func (idx *AddrIndex) AddUnconfirmedTx(tx *btcutil.Tx, utxoView *blockchain.UtxoViewpoint) {
  	// Index addresses of all referenced previous transaction outputs.
  	//
  	// The existence checks are elided since this is only called after the
  	// transaction has already been validated and thus all inputs are
  	// already known to exist.
  	for _, txIn := range tx.MsgTx().TxIn {
  		entry := utxoView.LookupEntry(txIn.PreviousOutPoint)
  		if entry == nil {
  			// Ignore missing entries.  This should never happen
  			// in practice since the function comments specifically
  			// call out all inputs must be available.
  			continue
  		}
  		idx.indexUnconfirmedAddresses(entry.PkScript(), tx)
  	}
  
  	// Index addresses of all created outputs.
  	for _, txOut := range tx.MsgTx().TxOut {
  		idx.indexUnconfirmedAddresses(txOut.PkScript, tx)
  	}
  }
docs: // AddUnconfirmedTx adds all addresses related to the transaction to the
  // unconfirmed (memory-only) address index.
  //
  // NOTE: This transaction MUST have already been validated by the memory pool
  // before calling this function with it and have all of the inputs available in
  // the provided utxo view.  Failure to do so could result in some or all
  // addresses not being indexed.
  //
  // This function is safe for concurrent access.