You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

p2p-mempool.py 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  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.
  6. Test that nodes are disconnected if they send mempool messages when bloom
  7. filters are not enabled.
  8. """
  9. from test_framework.mininode import *
  10. from test_framework.test_framework import BitcoinTestFramework
  11. from test_framework.util import *
  12. class P2PMempoolTests(BitcoinTestFramework):
  13. def set_test_params(self):
  14. self.setup_clean_chain = True
  15. self.num_nodes = 1
  16. self.extra_args = [["-peerbloomfilters=0"]]
  17. def run_test(self):
  18. #connect a mininode
  19. aTestNode = NodeConnCB()
  20. node = NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], aTestNode)
  21. aTestNode.add_connection(node)
  22. NetworkThread().start()
  23. aTestNode.wait_for_verack()
  24. #request mempool
  25. aTestNode.send_message(msg_mempool())
  26. aTestNode.wait_for_disconnect()
  27. #mininode must be disconnected at this point
  28. assert_equal(len(self.nodes[0].getpeerinfo()), 0)
  29. if __name__ == '__main__':
  30. P2PMempoolTests().main()