1#!/usr/bin/env python3 2# Copyright (c) 2015-2018 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. 6 7Test that nodes are disconnected if they send mempool messages when bloom 8filters are not enabled. 9""" 10 11from test_framework.messages import msg_mempool 12from test_framework.mininode import P2PInterface 13from test_framework.test_framework import BitcoinTestFramework 14from test_framework.util import assert_equal 15 16class P2PMempoolTests(BitcoinTestFramework): 17 def set_test_params(self): 18 self.setup_clean_chain = True 19 self.num_nodes = 1 20 self.extra_args = [["-peerbloomfilters=0"]] 21 22 def run_test(self): 23 # Add a p2p connection 24 self.nodes[0].add_p2p_connection(P2PInterface()) 25 26 #request mempool 27 self.nodes[0].p2p.send_message(msg_mempool()) 28 self.nodes[0].p2p.wait_for_disconnect() 29 30 #mininode must be disconnected at this point 31 assert_equal(len(self.nodes[0].getpeerinfo()), 0) 32 33if __name__ == '__main__': 34 P2PMempoolTests().main() 35