mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 07:07:45 +01:00
bugfix: fix bech32_encode calls in gen_key_io_test_vectors.py
This commit is contained in:
parent
8ec881d3b6
commit
5c0210e3e6
1 changed files with 3 additions and 3 deletions
|
@ -149,7 +149,7 @@ def gen_valid_bech32_vector(template):
|
||||||
witprog = bytearray(os.urandom(template[2]))
|
witprog = bytearray(os.urandom(template[2]))
|
||||||
encoding = template[4]
|
encoding = template[4]
|
||||||
dst_prefix = bytearray(template[5])
|
dst_prefix = bytearray(template[5])
|
||||||
rv = bech32_encode(hrp, [witver] + convertbits(witprog, 8, 5), encoding)
|
rv = bech32_encode(encoding, hrp, [witver] + convertbits(witprog, 8, 5))
|
||||||
return rv, dst_prefix + witprog
|
return rv, dst_prefix + witprog
|
||||||
|
|
||||||
def gen_valid_vectors():
|
def gen_valid_vectors():
|
||||||
|
@ -210,7 +210,7 @@ def gen_invalid_bech32_vector(template):
|
||||||
encoding = template[3]
|
encoding = template[3]
|
||||||
|
|
||||||
if no_data:
|
if no_data:
|
||||||
rv = bech32_encode(hrp, [], encoding)
|
rv = bech32_encode(encoding, hrp, [])
|
||||||
else:
|
else:
|
||||||
data = [witver] + convertbits(witprog, 8, 5)
|
data = [witver] + convertbits(witprog, 8, 5)
|
||||||
if template[4] and not no_data:
|
if template[4] and not no_data:
|
||||||
|
@ -218,7 +218,7 @@ def gen_invalid_bech32_vector(template):
|
||||||
data[-1] |= 1
|
data[-1] |= 1
|
||||||
else:
|
else:
|
||||||
data.append(0)
|
data.append(0)
|
||||||
rv = bech32_encode(hrp, data, encoding)
|
rv = bech32_encode(encoding, hrp, data)
|
||||||
|
|
||||||
if template[5]:
|
if template[5]:
|
||||||
i = len(rv) - random.randrange(1, 7)
|
i = len(rv) - random.randrange(1, 7)
|
||||||
|
|
Loading…
Add table
Reference in a new issue