From e4605d9dd498a1fa713e6a916347a7c887f2c2b8 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Wed, 7 Jun 2017 17:08:32 -0700 Subject: Tests for zmqpubrawtx and zmqpubrawblock Github-Pull: #10552 Rebased-From: d3677ab757ea57b21d8aed24d5bc3c4bfe9bb68c --- test/functional/zmq_test.py | 52 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) (limited to 'test/functional/zmq_test.py') diff --git a/test/functional/zmq_test.py b/test/functional/zmq_test.py index 3f2668ee87..382ef5bae2 100755 --- a/test/functional/zmq_test.py +++ b/test/functional/zmq_test.py @@ -10,7 +10,8 @@ import struct from test_framework.test_framework import BitcoinTestFramework, SkipTest from test_framework.util import (assert_equal, bytes_to_hex_str, - ) + hash256, + ) class ZMQTest (BitcoinTestFramework): def set_test_params(self): @@ -37,9 +38,12 @@ class ZMQTest (BitcoinTestFramework): self.zmqSubSocket.set(zmq.RCVTIMEO, 60000) self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock") self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx") + self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawblock") + self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"rawtx") ip_address = "tcp://127.0.0.1:28332" self.zmqSubSocket.connect(ip_address) - self.extra_args = [['-zmqpubhashtx=%s' % ip_address, '-zmqpubhashblock=%s' % ip_address], []] + self.extra_args = [['-zmqpubhashblock=%s' % ip_address, '-zmqpubhashtx=%s' % ip_address, + '-zmqpubrawblock=%s' % ip_address, '-zmqpubrawtx=%s' % ip_address], []] self.add_nodes(self.num_nodes, self.extra_args) self.start_nodes() @@ -59,28 +63,51 @@ class ZMQTest (BitcoinTestFramework): msg = self.zmqSubSocket.recv_multipart() topic = msg[0] assert_equal(topic, b"hashtx") - body = msg[1] + txhash = msg[1] msgSequence = struct.unpack('