def setup_nodes(self): skip_if_no_py3_zmq() skip_if_no_bitcoind_zmq(self) import zmq # Initialize ZMQ context and socket. # All messages are received in the same socket which means # that this test fails if the publishing order changes. # Note that the publishing order is not defined in the documentation and # is subject to change. address = "tcp://127.0.0.1:28332" self.zmq_context = zmq.Context() socket = self.zmq_context.socket(zmq.SUB) socket.set(zmq.RCVTIMEO, 60000) socket.connect(address) # Subscribe to all available topics. self.hashblock = ZMQSubscriber(socket, b"hashblock") self.hashtx = ZMQSubscriber(socket, b"hashtx") self.rawblock = ZMQSubscriber(socket, b"rawblock") self.rawtx = ZMQSubscriber(socket, b"rawtx") self.extra_args = [["-zmqpub%s=%s" % (sub.topic.decode(), address) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx]], []] self.add_nodes(self.num_nodes, self.extra_args) self.start_nodes()
def setup_nodes(self): skip_if_no_py3_zmq() skip_if_no_bitcoind_zmq(self) import zmq # Initialize ZMQ context and socket. # All messages are received in the same socket which means # that this test fails if the publishing order changes. # Note that the publishing order is not defined in the documentation and # is subject to change. address = "tcp://127.0.0.1:28332" self.zmq_context = zmq.Context() socket = self.zmq_context.socket(zmq.SUB) socket.set(zmq.RCVTIMEO, 60000) socket.connect(address) # Subscribe to all available topics. self.hashblock = ZMQSubscriber(socket, b"hashblock") self.hashtx = ZMQSubscriber(socket, b"hashtx") self.rawblock = ZMQSubscriber(socket, b"rawblock") self.rawtx = ZMQSubscriber(socket, b"rawtx") self.extra_args = [[ "-zmqpub%s=%s" % (sub.topic.decode(), address) for sub in [self.hashblock, self.hashtx, self.rawblock, self.rawtx] ], []] self.add_nodes(self.num_nodes, self.extra_args) self.start_nodes()
def run_test(self): # Check that xazabd has been built with ZMQ enabled. config = configparser.ConfigParser() config.read_file(open(self.options.configfile)) skip_if_no_py3_zmq() skip_if_no_bitcoind_zmq(self) try: # Setup the ZMQ subscriber socket self.zmq_context = zmq.Context() self.socket = self.zmq_context.socket(zmq.SUB) self.socket.connect(self.address) # Initialize the network self.activate_dip8() self.nodes[0].spork("SPORK_17_QUORUM_DKG_ENABLED", 0) self.wait_for_sporks_same() # Create an LLMQ for testing self.quorum_type = 100 # llmq_test self.quorum_hash = self.mine_quorum() self.sync_blocks() self.wait_for_chainlocked_block_all_nodes( self.nodes[0].getbestblockhash()) # Wait a moment to avoid subscribing to recovered sig in the test before the one from the chainlock # has been sent which leads to test failure. time.sleep(1) # Test all xazab related ZMQ publisher self.test_recovered_signature_publishers() self.test_chainlock_publishers() self.test_instantsend_publishers() self.test_governance_publishers() finally: # Destroy the ZMQ context. self.log.debug("Destroying ZMQ context") self.zmq_context.destroy(linger=None)
def setup_nodes(self): skip_if_no_py3_zmq() skip_if_no_bitcoind_zmq(self) import zmq self.zmq_context = zmq.Context() self.games = {} for g in ["a", "b", "ignored"]: self.games[g] = GameSubscriber(self.zmq_context, self._address, g) args = [] args.append("-zmqpubgameblocks=%s" % self._address) args.extend(["-trackgame=%s" % g for g in ["a", "b", "other"]]) self.extra_args = [args] self.add_nodes(self.num_nodes, self.extra_args) self.start_nodes() self.node = self.nodes[0]
def run_test(self): skip_if_no_py3_zmq() skip_if_no_bitcoind_zmq(self) self._test_getzmqnotifications()