aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_filter.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/p2p_filter.py')
-rwxr-xr-xtest/functional/p2p_filter.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/functional/p2p_filter.py b/test/functional/p2p_filter.py
index 2940542e5e..b73d5784aa 100755
--- a/test/functional/p2p_filter.py
+++ b/test/functional/p2p_filter.py
@@ -11,12 +11,10 @@ from test_framework.messages import (
MSG_FILTERED_BLOCK,
msg_getdata,
msg_filterload,
+ msg_filteradd,
msg_filterclear,
)
-from test_framework.mininode import (
- P2PInterface,
- mininode_lock,
-)
+from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
@@ -68,18 +66,15 @@ class FilterTest(BitcoinTestFramework):
filter_address = self.nodes[0].decodescript(filter_node.watch_script_pubkey)['addresses'][0]
self.log.info('Check that we receive merkleblock and tx if the filter matches a tx in a block')
- filter_node.merkleblock_received = False
block_hash = self.nodes[0].generatetoaddress(1, filter_address)[0]
txid = self.nodes[0].getblock(block_hash)['tx'][0]
+ filter_node.wait_for_merkleblock(block_hash)
filter_node.wait_for_tx(txid)
- assert filter_node.merkleblock_received
self.log.info('Check that we only receive a merkleblock if the filter does not match a tx in a block')
- with mininode_lock:
- filter_node.last_message.pop("merkleblock", None)
filter_node.tx_received = False
- self.nodes[0].generatetoaddress(1, self.nodes[0].getnewaddress())
- filter_node.wait_for_merkleblock()
+ block_hash = self.nodes[0].generatetoaddress(1, self.nodes[0].getnewaddress())[0]
+ filter_node.wait_for_merkleblock(block_hash)
assert not filter_node.tx_received
self.log.info('Check that we not receive a tx if the filter does not match a mempool tx')
@@ -103,6 +98,10 @@ class FilterTest(BitcoinTestFramework):
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 7)
filter_node.wait_for_tx(txid)
+ self.log.info("Check that division-by-zero remote crash bug [CVE-2013-5700] is fixed")
+ filter_node.send_and_ping(msg_filterload(data=b'', nHashFuncs=1))
+ filter_node.send_and_ping(msg_filteradd(data=b'letstrytocrashthisnode'))
+
if __name__ == '__main__':
FilterTest().main()