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:
Sebastian Falbesoner
2021-07-31 21:23:16 +02:00
parent f2e41d1109
commit ca6c154ef1
15 changed files with 40 additions and 57 deletions

View File

@@ -27,7 +27,6 @@ from test_framework.script_util import (
script_to_p2sh_script,
script_to_p2wsh_script,
)
from test_framework.util import hex_str_to_bytes
Key = namedtuple('Key', ['privkey',
'pubkey',
@@ -93,7 +92,7 @@ def get_multisig(node):
addr = node.getaddressinfo(node.getnewaddress())
addrs.append(addr['address'])
pubkeys.append(addr['pubkey'])
script_code = CScript([OP_2] + [hex_str_to_bytes(pubkey) for pubkey in pubkeys] + [OP_3, OP_CHECKMULTISIG])
script_code = CScript([OP_2] + [bytes.fromhex(pubkey) for pubkey in pubkeys] + [OP_3, OP_CHECKMULTISIG])
witness_script = script_to_p2wsh_script(script_code)
return Multisig(privkeys=[node.dumpprivkey(addr) for addr in addrs],
pubkeys=pubkeys,