2016-05-20 10:50:48 -04:00
|
|
|
#!/usr/bin/env python3
|
2018-07-26 18:36:45 -04:00
|
|
|
# Copyright (c) 2015-2018 The Bitcoin Core developers
|
2016-05-20 10:50:48 -04:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2017-01-17 20:34:40 -03:00
|
|
|
"""Test p2p mempool message.
|
|
|
|
|
|
|
|
Test that nodes are disconnected if they send mempool messages when bloom
|
|
|
|
filters are not enabled.
|
|
|
|
"""
|
2016-05-20 10:50:48 -04:00
|
|
|
|
2018-07-06 18:10:35 -04:00
|
|
|
from test_framework.messages import msg_mempool
|
|
|
|
from test_framework.mininode import P2PInterface
|
2016-05-20 10:50:48 -04:00
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
2018-07-06 18:10:35 -04:00
|
|
|
from test_framework.util import assert_equal
|
2016-05-20 10:50:48 -04:00
|
|
|
|
|
|
|
class P2PMempoolTests(BitcoinTestFramework):
|
2017-06-09 18:21:21 -04:00
|
|
|
def set_test_params(self):
|
2016-06-30 08:49:59 -04:00
|
|
|
self.setup_clean_chain = True
|
2017-04-03 10:34:04 -03:00
|
|
|
self.num_nodes = 1
|
|
|
|
self.extra_args = [["-peerbloomfilters=0"]]
|
2016-05-20 10:50:48 -04:00
|
|
|
|
|
|
|
def run_test(self):
|
2017-08-24 16:36:02 -03:00
|
|
|
# Add a p2p connection
|
2017-10-17 17:16:39 -03:00
|
|
|
self.nodes[0].add_p2p_connection(P2PInterface())
|
2016-05-20 10:50:48 -04:00
|
|
|
|
|
|
|
#request mempool
|
2017-08-24 16:36:02 -03:00
|
|
|
self.nodes[0].p2p.send_message(msg_mempool())
|
|
|
|
self.nodes[0].p2p.wait_for_disconnect()
|
2016-05-20 10:50:48 -04:00
|
|
|
|
|
|
|
#mininode must be disconnected at this point
|
|
|
|
assert_equal(len(self.nodes[0].getpeerinfo()), 0)
|
2018-04-16 06:13:07 -03:00
|
|
|
|
2016-05-20 10:50:48 -04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
P2PMempoolTests().main()
|