Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/util.py
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | def check_json_precision(): | ||||
if satoshis != 2000000000000003: | if satoshis != 2000000000000003: | ||||
raise RuntimeError("JSON encode/decode loses precision") | raise RuntimeError("JSON encode/decode loses precision") | ||||
def count_bytes(hex_string): | def count_bytes(hex_string): | ||||
return len(bytearray.fromhex(hex_string)) | return len(bytearray.fromhex(hex_string)) | ||||
def b_2_x(byte_str): | |||||
return byte_str.hex() | |||||
def hash256(byte_str): | def hash256(byte_str): | ||||
sha256 = hashlib.sha256() | sha256 = hashlib.sha256() | ||||
sha256.update(byte_str) | sha256.update(byte_str) | ||||
sha256d = hashlib.sha256() | sha256d = hashlib.sha256() | ||||
sha256d.update(sha256.digest()) | sha256d.update(sha256.digest()) | ||||
return sha256d.digest()[::-1] | return sha256d.digest()[::-1] | ||||
▲ Show 20 Lines • Show All 419 Lines • Show Last 20 Lines |