mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
c02337e1b0
fa87da2f172ae2e6dc15e9ed156a3564a8ecfbdd qa: Avoid start/stop of the network thread mid-test (MarcoFalke) Pull request description: This simplifies test writing by removing the need to handle the network thread in tests. E.g. start thread, join thread, restart thread mid-test, adding p2p connections at the "right" time, ... Tree-SHA512: 533642f12fef5496f1933855edcdab1a7ed901d088d34911749cd0f9e044c8a6cb1f89985ac3a7f41a512943663e4e270a61978f6f072143ae050cd102d4eab8
35 lines
1.1 KiB
Python
Executable File
35 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2015-2016 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())
|
|
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()
|