diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-10-16 13:51:00 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-10-16 13:48:17 +0200 |
commit | fa68755364473e48cf039e8cc2d08036fe58c1f6 (patch) | |
tree | bcfc8a2affa76831b1a7ca2c6d24449a32e4fc11 /contrib/testgen | |
parent | cb21d864c52b7858000ff6c8727240f1721132a9 (diff) |
contrib: Fix gen_key_io_test_vectors.py imports
Diffstat (limited to 'contrib/testgen')
-rwxr-xr-x | contrib/testgen/gen_key_io_test_vectors.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/contrib/testgen/gen_key_io_test_vectors.py b/contrib/testgen/gen_key_io_test_vectors.py index a00acb1f41..49320d92e6 100755 --- a/contrib/testgen/gen_key_io_test_vectors.py +++ b/contrib/testgen/gen_key_io_test_vectors.py @@ -15,8 +15,7 @@ import os from itertools import islice from base58 import b58encode_chk, b58decode_chk, b58chars import random -from binascii import b2a_hex -from segwit_addr import bech32_encode, decode, convertbits, CHARSET +from segwit_addr import bech32_encode, decode_segwit_address, convertbits, CHARSET # key types PUBKEY_ADDRESS = 0 @@ -109,7 +108,7 @@ def is_valid(v): def is_valid_bech32(v): '''Check vector v for bech32 validity''' for hrp in ['bc', 'tb', 'bcrt']: - if decode(hrp, v) != (None, None): + if decode_segwit_address(hrp, v) != (None, None): return True return False @@ -141,9 +140,7 @@ def gen_valid_vectors(): rv, payload = valid_vector_generator(template) assert is_valid(rv) metadata = {x: y for x, y in zip(metadata_keys,template[3]) if y is not None} - hexrepr = b2a_hex(payload) - if isinstance(hexrepr, bytes): - hexrepr = hexrepr.decode('utf8') + hexrepr = payload.hex() yield (rv, hexrepr, metadata) def gen_invalid_base58_vector(template): |