This PR makes the output of gen_base58_test_vectors.py to fit to current test format.
The test has already been changed(separated) from base58_test to key_io_test, so change the file name of this script as well.
(This will solve #13553 )
This script requires segwit_addr.py known as BIP173 Reference implementations for Python.
(See https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Reference_implementations )
Since it is included in test_framework, we can execute as follows:
$ PYTHONPATH=../../test/functional/test_framework ./gen_key_io_test_vectors.py valid 50 > ../../src/test/data/key_io_keys_valid.json
237 | - val += random.choice(b58chars) 238 | - else: # replace random character in the middle 239 | - n = random.randint(0, len(val)) 240 | - val = val[0:n] + random.choice(b58chars) + val[n+1:] 241 | + for template, gen_invalid_vector in [(t, g) for g, l in zip(glist, tlist) for t in l]: 242 | + val = gen_invalid_vector(template)
A bit long, but maybe call it invalid_vector_generator, since it is very close to the function names above. I thought for a moment it was referring to the function called gen_invalid_vectors but it had an s, I realized.
utACK c7cbd2cd9eb6f8df4348643f0a02d2dbc487197c
@kallewoof fixed. -- renamed as below:
gen_valid_vector to valid_vector_generatorgen_invalid_vector to invalid_vector_generatorre-utACK 512c25f2348dc01e5dc92e84698ba61c66fcfb5a
utACK 512c25f2348dc01e5dc92e84698ba61c66fcfb5a after squash
utACK 512c25f after squash
a reminder to squash this according to the workflow in CONTRIBUTING.md (otherwise, this could be merged)
Ajust the outputs of gen_base58_test_vectors.py to current test format.
1. Add bech32 vector generation.
2. Add Script-fragments to hexrepr in the format expected by the test.
3. Modify the metadata.
1) Change 'isTestnet' to 'chain' (main/test/regtest)
2) Remove 'addrType'
3) Add 'tryCaseFlip' (True/False on bech32)
Milestone
0.18.0