Tests for zmqpubrawtx and zmqpubrawblock

Github-Pull: #10552
Rebased-From: d3677ab757
This commit is contained in:
Andrew Chow
2017-06-07 17:08:32 -07:00
committed by MarcoFalke
parent 2c4ff35a8f
commit e4605d9dd4
2 changed files with 54 additions and 6 deletions

View File

@@ -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'))