Changeset View
Changeset View
Standalone View
Standalone View
test/functional/interface_zmq.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2019 The Bitcoin Core developers | # Copyright (c) 2015-2019 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test the ZMQ notification interface.""" | """Test the ZMQ notification interface.""" | ||||
import struct | import struct | ||||
from io import BytesIO | from io import BytesIO | ||||
from test_framework.test_framework import ( | from test_framework.test_framework import BitcoinTestFramework | ||||
BitcoinTestFramework, | |||||
skip_if_no_bitcoind_zmq, | |||||
skip_if_no_py3_zmq, | |||||
) | |||||
from test_framework.messages import CTransaction | from test_framework.messages import CTransaction | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
hash256, | hash256, | ||||
) | ) | ||||
class ZMQSubscriber: | class ZMQSubscriber: | ||||
Show All 14 Lines | def receive(self): | ||||
self.sequence += 1 | self.sequence += 1 | ||||
return body | return body | ||||
class ZMQTest (BitcoinTestFramework): | class ZMQTest (BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
def setup_nodes(self): | def skip_test_if_missing_module(self): | ||||
skip_if_no_py3_zmq() | self.skip_if_no_py3_zmq() | ||||
skip_if_no_bitcoind_zmq(self) | self.skip_if_no_bitcoind_zmq() | ||||
self.skip_if_no_wallet() | |||||
def setup_nodes(self): | |||||
# Import keys | # Import keys | ||||
self.add_nodes(self.num_nodes) | self.add_nodes(self.num_nodes) | ||||
self.start_nodes() | self.start_nodes() | ||||
super().import_deterministic_coinbase_privkeys() | super().import_deterministic_coinbase_privkeys() | ||||
self.stop_nodes() | self.stop_nodes() | ||||
import zmq | import zmq | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |