aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/util.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-09-29 19:44:10 +0200
committerMarcoFalke <falke.marco@gmail.com>2017-09-29 19:44:54 +0200
commit9c3c9cdae3e20b5bdea91a0631edac5116bbc89f (patch)
tree9b4e25d1f070572f09c601c4406c41304819c6eb /test/functional/test_framework/util.py
parent93d20a734d2ee873832bed8ca5c05cf8e539c53c (diff)
parentd3677ab757ea57b21d8aed24d5bc3c4bfe9bb68c (diff)
downloadbitcoin-9c3c9cdae3e20b5bdea91a0631edac5116bbc89f.tar.xz
Merge #10552: [Test] Tests for zmqpubrawtx and zmqpubrawblock
d3677ab75 Tests for zmqpubrawtx and zmqpubrawblock (Andrew Chow) Pull request description: Tree-SHA512: 9e367fd8936514bfb567ef3f3d83770d374287354b59c9187e844056dd086e8aa2de32ce55d35486cecd706e7c93cd1c1e2709ee82d3dddb805827be8d2bcb14
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r--test/functional/test_framework/util.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index b2d8199d12..64966adb97 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -7,6 +7,7 @@
from base64 import b64encode
from binascii import hexlify, unhexlify
from decimal import Decimal, ROUND_DOWN
+import hashlib
import json
import logging
import os
@@ -173,6 +174,13 @@ def count_bytes(hex_string):
def bytes_to_hex_str(byte_str):
return hexlify(byte_str).decode('ascii')
+def hash256(byte_str):
+ sha256 = hashlib.sha256()
+ sha256.update(byte_str)
+ sha256d = hashlib.sha256()
+ sha256d.update(sha256.digest())
+ return sha256d.digest()[::-1]
+
def hex_str_to_bytes(hex_str):
return unhexlify(hex_str.encode('ascii'))