aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_mempool.py
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2018-01-25 09:44:29 +1000
committerAnthony Towns <aj@erisian.com.au>2018-01-25 09:44:29 +1000
commit61b8f7f273022d3163f998ff5d66d53ca0460c8b (patch)
treef0c697967c9a15ea61758170af0cd0418ab34585 /test/functional/p2p_mempool.py
parent90600bc7db2a8047c93bc10d403e862141ada770 (diff)
[tests] Rename p2p_* functional tests.
Diffstat (limited to 'test/functional/p2p_mempool.py')
-rwxr-xr-xtest/functional/p2p_mempool.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/p2p_mempool.py b/test/functional/p2p_mempool.py
new file mode 100755
index 0000000000..485a8af3d0
--- /dev/null
+++ b/test/functional/p2p_mempool.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+# Copyright (c) 2015-2017 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(P2PInterface())
+ 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()