Skip to content

Commit 59d3da5

Browse files
committed
Do addmultisigaddress tests in legacy wallet mode in wallet_address_types.py
addmultisigaddress is not available in descriptor wallets, so only run these when testing legacy wallets
1 parent 25bc5dc commit 59d3da5

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

test/functional/wallet_address_types.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,18 +228,25 @@ def run_test(self):
228228
compressed_1 = "0296b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52"
229229
compressed_2 = "037211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073"
230230

231-
# addmultisigaddress with at least 1 uncompressed key should return a legacy address.
232-
for node in range(4):
233-
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, uncompressed_2])['address'], True, 'legacy')
234-
self.test_address(node, self.nodes[node].addmultisigaddress(2, [compressed_1, uncompressed_2])['address'], True, 'legacy')
235-
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, compressed_2])['address'], True, 'legacy')
236-
# addmultisigaddress with all compressed keys should return the appropriate address type (even when the keys are not ours).
237-
self.test_address(0, self.nodes[0].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'legacy')
238-
self.test_address(1, self.nodes[1].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
239-
self.test_address(2, self.nodes[2].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
240-
self.test_address(3, self.nodes[3].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'bech32')
241-
242-
for explicit_type, multisig, from_node in itertools.product([False, True], [False, True], range(4)):
231+
if not self.options.descriptors:
232+
# Tests for addmultisigaddress's address type behavior is only for legacy wallets.
233+
# Descriptor wallets do not have addmultsigaddress so these tests are not needed for those.
234+
# addmultisigaddress with at least 1 uncompressed key should return a legacy address.
235+
for node in range(4):
236+
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, uncompressed_2])['address'], True, 'legacy')
237+
self.test_address(node, self.nodes[node].addmultisigaddress(2, [compressed_1, uncompressed_2])['address'], True, 'legacy')
238+
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, compressed_2])['address'], True, 'legacy')
239+
# addmultisigaddress with all compressed keys should return the appropriate address type (even when the keys are not ours).
240+
self.test_address(0, self.nodes[0].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'legacy')
241+
self.test_address(1, self.nodes[1].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
242+
self.test_address(2, self.nodes[2].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
243+
self.test_address(3, self.nodes[3].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'bech32')
244+
245+
do_multisigs = [False]
246+
if not self.options.descriptors:
247+
do_multisigs.append(True)
248+
249+
for explicit_type, multisig, from_node in itertools.product([False, True], do_multisigs, range(4)):
243250
address_type = None
244251
if explicit_type and not multisig:
245252
if from_node == 1:

0 commit comments

Comments
 (0)