code: func (idx *AddrIndex) indexUnconfirmedAddresses(pkScript []byte, tx *btcutil.Tx) {
  	// The error is ignored here since the only reason it can fail is if the
  	// script fails to parse and it was already validated before being
  	// admitted to the mempool.
  	_, addresses, _, _ := txscript.ExtractPkScriptAddrs(pkScript,
  		idx.chainParams)
  	for _, addr := range addresses {
  		// Ignore unsupported address types.
  		addrKey, err := addrToKey(addr)
  		if err != nil {
  			continue
  		}
  
  		// Add a mapping from the address to the transaction.
  		idx.unconfirmedLock.Lock()
  		addrIndexEntry := idx.txnsByAddr[addrKey]
  		if addrIndexEntry == nil {
  			addrIndexEntry = make(map[chainhash.Hash]*btcutil.Tx)
  			idx.txnsByAddr[addrKey] = addrIndexEntry
  		}
  		addrIndexEntry[*tx.Hash()] = tx
  
  		// Add a mapping from the transaction to the address.
  		addrsByTxEntry := idx.addrsByTx[*tx.Hash()]
  		if addrsByTxEntry == nil {
  			addrsByTxEntry = make(map[[addrKeySize]byte]struct{})
  			idx.addrsByTx[*tx.Hash()] = addrsByTxEntry
  		}
  		addrsByTxEntry[addrKey] = struct{}{}
  		idx.unconfirmedLock.Unlock()
  	}
  }
docs: // indexUnconfirmedAddresses modifies the unconfirmed (memory-only) address
  // index to include mappings for the addresses encoded by the passed public key
  // script to the transaction.
  //
  // This function is safe for concurrent access.