|
1 | 1 | #!/usr/bin/env python3
|
2 |
| -# Copyright (c) 2012-2021 The Bitcoin Core developers |
| 2 | +# Copyright (c) 2012-2022 The Bitcoin Core developers |
3 | 3 | # Distributed under the MIT software license, see the accompanying
|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 | '''
|
6 | 6 | Generate valid and invalid base58/bech32(m) address and private key test vectors.
|
7 | 7 |
|
8 | 8 | Usage:
|
9 |
| - PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json |
10 |
| - PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json |
| 9 | + ./gen_key_io_test_vectors.py valid 70 > ../../src/test/data/key_io_valid.json |
| 10 | + ./gen_key_io_test_vectors.py invalid 70 > ../../src/test/data/key_io_invalid.json |
11 | 11 | '''
|
12 |
| -# 2012 Wladimir J. van der Laan |
13 |
| -# Released under MIT License |
| 12 | + |
14 | 13 | import os
|
15 | 14 | from itertools import islice
|
16 | 15 | from base58 import b58encode_chk, b58decode_chk, b58chars
|
17 | 16 | import random
|
18 |
| -from segwit_addr import bech32_encode, decode_segwit_address, convertbits, CHARSET, Encoding |
| 17 | +import sys |
| 18 | + |
| 19 | +sys.path.append(os.path.join(os.path.dirname(__file__), '../../test/functional')) |
| 20 | + |
| 21 | +from test_framework.segwit_addr import bech32_encode, decode_segwit_address, convertbits, CHARSET, Encoding # noqa: E402 |
19 | 22 |
|
20 | 23 | # key types
|
21 | 24 | PUBKEY_ADDRESS = 0
|
@@ -250,7 +253,6 @@ def gen_invalid_vectors():
|
250 | 253 | yield val,
|
251 | 254 |
|
252 | 255 | if __name__ == '__main__':
|
253 |
| - import sys |
254 | 256 | import json
|
255 | 257 | iters = {'valid':gen_valid_vectors, 'invalid':gen_invalid_vectors}
|
256 | 258 | try:
|
|
0 commit comments