From e37bd6d96c927538227f1a9da746c28bf0b1137f Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Tue, 24 Sep 2019 15:09:07 +0200 Subject: [PATCH] Fix zmq_test.py --- test/functional/zmq_test.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/functional/zmq_test.py b/test/functional/zmq_test.py index c60d8bb7dd..8445241bd6 100755 --- a/test/functional/zmq_test.py +++ b/test/functional/zmq_test.py @@ -7,12 +7,18 @@ import configparser import os import struct +from codecs import encode + +from test_framework.mininode import dashhash from test_framework.test_framework import BitcoinTestFramework, SkipTest from test_framework.util import (assert_equal, bytes_to_hex_str, hash256, ) +def dashhash_helper(b): + return encode(dashhash(b)[::-1], 'hex_codec').decode('ascii') + class ZMQTest (BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 @@ -97,7 +103,7 @@ class ZMQTest (BitcoinTestFramework): assert_equal(msgSequence, 0) #must be sequence 0 on rawblock # Check the hash of the rawblock's header matches generate - assert_equal(genhashes[0], bytes_to_hex_str(hash256(body[:80]))) + assert_equal(genhashes[0], dashhash_helper(body[:80])) self.log.info("Generate 10 blocks (and 10 coinbase txes)") n = 10 @@ -117,7 +123,7 @@ class ZMQTest (BitcoinTestFramework): assert_equal(msgSequence, blockcount + 1) blockcount += 1 if topic == b"rawblock": - zmqRawHashed.append(bytes_to_hex_str(hash256(body[:80]))) + zmqRawHashed.append(dashhash_helper(body[:80])) msgSequence = struct.unpack('