f4ea836744
5c8ff26 [tests] Add NetworkThread assertions (John Newbery) 34e08b3 [tests] Fix network threading in functional tests (John Newbery) 74e64f2 [tests] Use network_thread_start() in tests. (John Newbery) 5fc6e71 [tests] Add network_thread_ utility functions. (John Newbery) Pull request description: Add assert that only one NetworkThread exists at any time in functional tests, and fix cases where that wasn't true. fixes #11776 Tree-SHA512: fe5d1c59005f94bf66e11bb23ccf274b1cd9913741b56ea11dbcd21db4cc0b53b4413c0c4c16dbcd6ac611adad5e5cc2baaa39720598ce7b6393889945d06298
36 lines
1.1 KiB
Python
Executable File
36 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2015-2016 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test p2p mempool message.
|
|
|
|
Test that nodes are disconnected if they send mempool messages when bloom
|
|
filters are not enabled.
|
|
"""
|
|
|
|
from test_framework.mininode import *
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import *
|
|
|
|
class P2PMempoolTests(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.setup_clean_chain = True
|
|
self.num_nodes = 1
|
|
self.extra_args = [["-peerbloomfilters=0"]]
|
|
|
|
def run_test(self):
|
|
# Add a p2p connection
|
|
self.nodes[0].add_p2p_connection(NodeConnCB())
|
|
network_thread_start()
|
|
self.nodes[0].p2p.wait_for_verack()
|
|
|
|
#request mempool
|
|
self.nodes[0].p2p.send_message(msg_mempool())
|
|
self.nodes[0].p2p.wait_for_disconnect()
|
|
|
|
#mininode must be disconnected at this point
|
|
assert_equal(len(self.nodes[0].getpeerinfo()), 0)
|
|
|
|
if __name__ == '__main__':
|
|
P2PMempoolTests().main()
|