mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 18:09:47 +01:00
test: add coverage for bech32m in wallet_keypool_topup
This commit is contained in:
parent
5b9831a0a5
commit
a8bfc3dea1
@ -25,8 +25,10 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
|
||||
def set_test_params(self):
|
||||
self.setup_clean_chain = True
|
||||
self.num_nodes = 4
|
||||
self.extra_args = [[], ['-keypool=100'], ['-keypool=100'], ['-keypool=100']]
|
||||
self.num_nodes = 5
|
||||
self.extra_args = [[]]
|
||||
for _ in range(self.num_nodes - 1):
|
||||
self.extra_args.append(['-keypool=100'])
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
@ -40,12 +42,13 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
self.stop_node(1)
|
||||
shutil.copyfile(wallet_path, wallet_backup_path)
|
||||
self.start_node(1, self.extra_args[1])
|
||||
self.connect_nodes(0, 1)
|
||||
self.connect_nodes(0, 2)
|
||||
self.connect_nodes(0, 3)
|
||||
|
||||
for i, output_type in enumerate(["legacy", "p2sh-segwit", "bech32"]):
|
||||
for i in [1, 2, 3, 4]:
|
||||
self.connect_nodes(0, i)
|
||||
|
||||
output_types = ["legacy", "p2sh-segwit", "bech32"]
|
||||
if self.options.descriptors:
|
||||
output_types.append("bech32m")
|
||||
for i, output_type in enumerate(output_types):
|
||||
self.log.info("Generate keys for wallet with address type: {}".format(output_type))
|
||||
idx = i+1
|
||||
for _ in range(90):
|
||||
@ -59,9 +62,10 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
assert not address_details["isscript"] and not address_details["iswitness"]
|
||||
elif i == 1:
|
||||
assert address_details["isscript"] and not address_details["iswitness"]
|
||||
else:
|
||||
elif i == 2:
|
||||
assert not address_details["isscript"] and address_details["iswitness"]
|
||||
|
||||
elif i == 3:
|
||||
assert address_details["isscript"] and address_details["iswitness"]
|
||||
|
||||
self.log.info("Send funds to wallet")
|
||||
self.nodes[0].sendtoaddress(addr_oldpool, 10)
|
||||
@ -87,6 +91,8 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/49h/1h/0h/0/110")
|
||||
elif output_type == 'bech32':
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/84h/1h/0h/0/110")
|
||||
elif output_type == 'bech32m':
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/86h/1h/0h/0/110")
|
||||
else:
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/0'/0'/110'")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user