aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2017-06-07 17:08:32 -0700
committerAndrew Chow <achow101-github@achow101.com>2017-09-18 22:08:07 -0400
commitd3677ab757ea57b21d8aed24d5bc3c4bfe9bb68c (patch)
tree88990d7ed9887a3b0b23ecb41e9e17bf1f70de90 /test/functional/test_framework
parentbcc8a620eae9cd8fe95f0a02f17183c4a132e5a2 (diff)
Tests for zmqpubrawtx and zmqpubrawblock
Diffstat (limited to 'test/functional/test_framework')
-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 a14cda07d0..f819edcc3d 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
@@ -148,6 +149,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'))