diff options
author | Andrew Chow <achow101-github@achow101.com> | 2017-06-07 17:08:32 -0700 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-10-03 22:03:09 +0200 |
commit | e4605d9dd498a1fa713e6a916347a7c887f2c2b8 (patch) | |
tree | 9d82d1c7eb05740f00930e2eed607a568bbed06d /test/functional/test_framework/util.py | |
parent | 2c4ff35a8fce0c40884886a93c1bf12395fb105d (diff) | |
download | bitcoin-e4605d9dd498a1fa713e6a916347a7c887f2c2b8.tar.xz |
Tests for zmqpubrawtx and zmqpubrawblock
Github-Pull: #10552
Rebased-From: d3677ab757ea57b21d8aed24d5bc3c4bfe9bb68c
Diffstat (limited to 'test/functional/test_framework/util.py')
-rw-r--r-- | test/functional/test_framework/util.py | 8 |
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')) |