mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
refactor: replace remaining binascii method calls
This commit is contained in:
parent
f4328ebef5
commit
021daedfa1
7 changed files with 14 additions and 19 deletions
|
|
@ -19,7 +19,6 @@ Classes use __slots__ to ensure extraneous attributes aren't accidentally added
|
|||
by tests, compromising their intended effect.
|
||||
"""
|
||||
from base64 import b32decode, b32encode
|
||||
from codecs import encode
|
||||
import copy
|
||||
import hashlib
|
||||
from io import BytesIO
|
||||
|
|
@ -681,7 +680,7 @@ class CBlockHeader:
|
|||
r += struct.pack("<I", self.nBits)
|
||||
r += struct.pack("<I", self.nNonce)
|
||||
self.sha256 = uint256_from_str(hash256(r))
|
||||
self.hash = encode(hash256(r)[::-1], 'hex_codec').decode('ascii')
|
||||
self.hash = hash256(r)[::-1].hex()
|
||||
|
||||
def rehash(self):
|
||||
self.sha256 = None
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ Runs automatically during `make check`.
|
|||
Can also be run manually."""
|
||||
|
||||
import argparse
|
||||
import binascii
|
||||
import configparser
|
||||
import difflib
|
||||
import json
|
||||
|
|
@ -167,7 +166,7 @@ def parse_output(a, fmt):
|
|||
if fmt == 'json': # json: compare parsed data
|
||||
return json.loads(a)
|
||||
elif fmt == 'hex': # hex: parse and compare binary data
|
||||
return binascii.a2b_hex(a.strip())
|
||||
return bytes.fromhex(a.strip())
|
||||
else:
|
||||
raise NotImplementedError("Don't know how to compare %s" % fmt)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue