mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-11 03:53:22 +02:00
test: refactor: remove hex_str_to_bytes
helper
Use the built-in class method bytes.fromhex() instead, which is available since Python 3.0.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
"""Helpful routines for regression testing."""
|
||||
|
||||
from base64 import b64encode
|
||||
from binascii import unhexlify
|
||||
from decimal import Decimal, ROUND_DOWN
|
||||
from subprocess import CalledProcessError
|
||||
import hashlib
|
||||
@@ -214,10 +213,6 @@ def count_bytes(hex_string):
|
||||
return len(bytearray.fromhex(hex_string))
|
||||
|
||||
|
||||
def hex_str_to_bytes(hex_str):
|
||||
return unhexlify(hex_str.encode('ascii'))
|
||||
|
||||
|
||||
def str_to_b64str(string):
|
||||
return b64encode(string.encode('utf-8')).decode('ascii')
|
||||
|
||||
@@ -517,7 +512,7 @@ def gen_return_txouts():
|
||||
from .messages import CTxOut
|
||||
txout = CTxOut()
|
||||
txout.nValue = 0
|
||||
txout.scriptPubKey = hex_str_to_bytes(script_pubkey)
|
||||
txout.scriptPubKey = bytes.fromhex(script_pubkey)
|
||||
for _ in range(128):
|
||||
txouts.append(txout)
|
||||
return txouts
|
||||
|
Reference in New Issue
Block a user