chain: match transaction against currently watched transactions

In this commit, we extend the client's filtering process to also look at
the set of currently watched transactions. The logic to watch for
transaction hashes was previously there, but it was not used to filter
against incoming transactions.
This commit is contained in:
Wilmer Paulino 2018-07-26 17:47:10 -07:00
parent 00428d5828
commit 8357e86a4d

View file

@ -1217,6 +1217,14 @@ func (c *BitcoindClient) filterTx(tx *wire.MsgTx,
}
// If the transaction didn't pay to any of our watched addresses, we'll
// check if we're currently watching for the hash of this transaction.
if !isRelevant {
if _, ok := c.watchedTxs[tx.TxHash()]; ok {
isRelevant = true
}
}
// If the transaction didn't pay to any of our watched hashes, we'll
// check if it spends any of our watched outpoints.
if !isRelevant {
for _, in := range tx.TxIn {