Changeset View
Changeset View
Standalone View
Standalone View
test/functional/interface_zmq.py
Show All 38 Lines | def setup_nodes(self): | ||||
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB) | self.zmqSubSocket = self.zmqContext.socket(zmq.SUB) | ||||
self.zmqSubSocket.set(zmq.RCVTIMEO, 60000) | self.zmqSubSocket.set(zmq.RCVTIMEO, 60000) | ||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock") | self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock") | ||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx") | self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx") | ||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawblock") | self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawblock") | ||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawtx") | self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawtx") | ||||
ip_address = "tcp://127.0.0.1:28332" | ip_address = "tcp://127.0.0.1:28332" | ||||
self.zmqSubSocket.connect(ip_address) | self.zmqSubSocket.connect(ip_address) | ||||
self.extra_args = [['-zmqpubhashblock=%s' % ip_address, '-zmqpubhashtx=%s' % ip_address, | self.extra_args = [['-zmqpubhashblock={}'.format(ip_address), | ||||
'-zmqpubrawblock=%s' % ip_address, '-zmqpubrawtx=%s' % ip_address], []] | '-zmqpubhashtx={}'.format(ip_address), | ||||
'-zmqpubrawblock={}'.format(ip_address), | |||||
'-zmqpubrawtx={}'.format(ip_address)], []] | |||||
self.add_nodes(self.num_nodes, self.extra_args) | self.add_nodes(self.num_nodes, self.extra_args) | ||||
self.start_nodes() | self.start_nodes() | ||||
def run_test(self): | def run_test(self): | ||||
try: | try: | ||||
self._zmq_test() | self._zmq_test() | ||||
finally: | finally: | ||||
# Destroy the zmq context | # Destroy the zmq context | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |