Remove duplicate method definitions in NodeConnCB subclasses
[bitcoinplatinum.git] / test / functional / p2p-mempool.py
blob188016e7184c49d53dbcf8fe2085a4186f42dc78
1 #!/usr/bin/env python3
2 # Copyright (c) 2015-2016 The Bitcoin Core developers
3 # Distributed under the MIT software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 """Test p2p mempool message.
7 Test that nodes are disconnected if they send mempool messages when bloom
8 filters are not enabled.
9 """
11 from test_framework.mininode import *
12 from test_framework.test_framework import BitcoinTestFramework
13 from test_framework.util import *
15 class P2PMempoolTests(BitcoinTestFramework):
17 def __init__(self):
18 super().__init__()
19 self.setup_clean_chain = True
20 self.num_nodes = 2
22 def setup_network(self):
23 self.nodes = [start_node(0, self.options.tmpdir, ["-peerbloomfilters=0"])]
25 def run_test(self):
26 #connect a mininode
27 aTestNode = NodeConnCB()
28 node = NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], aTestNode)
29 aTestNode.add_connection(node)
30 NetworkThread().start()
31 aTestNode.wait_for_verack()
33 #request mempool
34 aTestNode.send_message(msg_mempool())
35 aTestNode.wait_for_disconnect()
37 #mininode must be disconnected at this point
38 assert_equal(len(self.nodes[0].getpeerinfo()), 0)
40 if __name__ == '__main__':
41 P2PMempoolTests().main()