// FilterTransactionsByAddress returns all transactions currently in the // mempool that either create an output to the passed address or spend a // previously created ouput to the address. func (mp *txMemPool) FilterTransactionsByAddress(addr btcutil.Address) ([]*btcutil.Tx, error) { // Protect concurrent access. mp.RLock() defer mp.RUnlock() if txs, exists := mp.addrindex[addr.EncodeAddress()]; exists { addressTxs := make([]*btcutil.Tx, 0, len(txs)) for txHash := range txs { if txD, exists := mp.pool[txHash]; exists { addressTxs = append(addressTxs, txD.Tx) } } return addressTxs, nil } return nil, fmt.Errorf("address does not have any transactions in the pool") }