Skip to content

Commit b44f9e4

Browse files
committed
Merge bitcoin/bitcoin#28928: test: add coverage for bech32m in wallet_keypool_topup
a8bfc3d test: add coverage for bech32m in `wallet_keypool_topup` (brunoerg) Pull request description: 0dcac51 added coverage for all keypool addresses types in `wallet_keypool_topup` (4y ago). Now we have bech23m, so this PR adds it. ACKs for top commit: achow101: ACK a8bfc3d marcofleon: ACK a8bfc3d. Definitely a more straightfoward addition to the test. Reviewed the code, built the PR branch and ran all functional tests without issues. furszy: utACK a8bfc3d Tree-SHA512: aa830b723a7a54b23744f9fb3cf5214452c4ffc8e3bbe0e8bd980bdf902e61c3dd2fd57361b82c5c0c5224aa0774158daf34b6b2188edda0a971f82111976051
2 parents 2102c97 + a8bfc3d commit b44f9e4

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

test/functional/wallet_keypool_topup.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ def add_options(self, parser):
2525

2626
def set_test_params(self):
2727
self.setup_clean_chain = True
28-
self.num_nodes = 4
29-
self.extra_args = [[], ['-keypool=100'], ['-keypool=100'], ['-keypool=100']]
28+
self.num_nodes = 5
29+
self.extra_args = [[]]
30+
for _ in range(self.num_nodes - 1):
31+
self.extra_args.append(['-keypool=100'])
3032

3133
def skip_test_if_missing_module(self):
3234
self.skip_if_no_wallet()
@@ -40,12 +42,13 @@ def run_test(self):
4042
self.stop_node(1)
4143
shutil.copyfile(wallet_path, wallet_backup_path)
4244
self.start_node(1, self.extra_args[1])
43-
self.connect_nodes(0, 1)
44-
self.connect_nodes(0, 2)
45-
self.connect_nodes(0, 3)
46-
47-
for i, output_type in enumerate(["legacy", "p2sh-segwit", "bech32"]):
45+
for i in [1, 2, 3, 4]:
46+
self.connect_nodes(0, i)
4847

48+
output_types = ["legacy", "p2sh-segwit", "bech32"]
49+
if self.options.descriptors:
50+
output_types.append("bech32m")
51+
for i, output_type in enumerate(output_types):
4952
self.log.info("Generate keys for wallet with address type: {}".format(output_type))
5053
idx = i+1
5154
for _ in range(90):
@@ -59,9 +62,10 @@ def run_test(self):
5962
assert not address_details["isscript"] and not address_details["iswitness"]
6063
elif i == 1:
6164
assert address_details["isscript"] and not address_details["iswitness"]
62-
else:
65+
elif i == 2:
6366
assert not address_details["isscript"] and address_details["iswitness"]
64-
67+
elif i == 3:
68+
assert address_details["isscript"] and address_details["iswitness"]
6569

6670
self.log.info("Send funds to wallet")
6771
self.nodes[0].sendtoaddress(addr_oldpool, 10)
@@ -87,6 +91,8 @@ def run_test(self):
8791
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/49h/1h/0h/0/110")
8892
elif output_type == 'bech32':
8993
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/84h/1h/0h/0/110")
94+
elif output_type == 'bech32m':
95+
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/86h/1h/0h/0/110")
9096
else:
9197
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/0'/0'/110'")
9298

0 commit comments

Comments
 (0)