|
11 | 11 | COIN,
|
12 | 12 | MAX_BLOOM_FILTER_SIZE,
|
13 | 13 | MAX_BLOOM_HASH_FUNCS,
|
| 14 | + MSG_WTX, |
14 | 15 | MSG_BLOCK,
|
15 | 16 | MSG_FILTERED_BLOCK,
|
16 | 17 | msg_filteradd,
|
@@ -135,14 +136,22 @@ def test_msg_mempool(self):
|
135 | 136 | self.log.info("Check that a node with bloom filters enabled services p2p mempool messages")
|
136 | 137 | filter_peer = P2PBloomFilter()
|
137 | 138 |
|
138 |
| - self.log.debug("Create a tx relevant to the peer before connecting") |
139 |
| - txid = self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=filter_peer.watch_script_pubkey, amount=9 * COIN)["txid"] |
| 139 | + self.log.info("Create two tx before connecting, one relevant to the node another that is not") |
| 140 | + rel_txid = self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=filter_peer.watch_script_pubkey, amount=1 * COIN)["txid"] |
| 141 | + irr_result = self.wallet.send_to(from_node=self.nodes[0], scriptPubKey=getnewdestination()[1], amount=2 * COIN) |
| 142 | + irr_txid = irr_result["txid"] |
| 143 | + irr_wtxid = irr_result["wtxid"] |
140 | 144 |
|
141 |
| - self.log.debug("Send a mempool msg after connecting and check that the tx is received") |
| 145 | + self.log.info("Send a mempool msg after connecting and check that the relevant tx is announced") |
142 | 146 | self.nodes[0].add_p2p_connection(filter_peer)
|
143 | 147 | filter_peer.send_and_ping(filter_peer.watch_filter_init)
|
144 | 148 | filter_peer.send_message(msg_mempool())
|
145 |
| - filter_peer.wait_for_tx(txid) |
| 149 | + filter_peer.wait_for_tx(rel_txid) |
| 150 | + |
| 151 | + self.log.info("Request the irrelevant transaction even though it was not announced") |
| 152 | + filter_peer.send_message(msg_getdata([CInv(t=MSG_WTX, h=int(irr_wtxid, 16))])) |
| 153 | + self.log.info("We should get it anyway because it was in the mempool on connection to peer") |
| 154 | + filter_peer.wait_for_tx(irr_txid) |
146 | 155 |
|
147 | 156 | def test_frelay_false(self, filter_peer):
|
148 | 157 | self.log.info("Check that a node with fRelay set to false does not receive invs until the filter is set")
|
|
0 commit comments