|
|
|
@ -228,18 +228,25 @@ class AddressTypeTest(BitcoinTestFramework):
|
|
|
|
|
compressed_1 = "0296b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52"
|
|
|
|
|
compressed_2 = "037211a824f55b505228e4c3d5194c1fcfaa15a456abdf37f9b9d97a4040afc073"
|
|
|
|
|
|
|
|
|
|
# addmultisigaddress with at least 1 uncompressed key should return a legacy address.
|
|
|
|
|
for node in range(4):
|
|
|
|
|
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, uncompressed_2])['address'], True, 'legacy')
|
|
|
|
|
self.test_address(node, self.nodes[node].addmultisigaddress(2, [compressed_1, uncompressed_2])['address'], True, 'legacy')
|
|
|
|
|
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, compressed_2])['address'], True, 'legacy')
|
|
|
|
|
# addmultisigaddress with all compressed keys should return the appropriate address type (even when the keys are not ours).
|
|
|
|
|
self.test_address(0, self.nodes[0].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'legacy')
|
|
|
|
|
self.test_address(1, self.nodes[1].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
|
|
|
|
|
self.test_address(2, self.nodes[2].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
|
|
|
|
|
self.test_address(3, self.nodes[3].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'bech32')
|
|
|
|
|
|
|
|
|
|
for explicit_type, multisig, from_node in itertools.product([False, True], [False, True], range(4)):
|
|
|
|
|
if not self.options.descriptors:
|
|
|
|
|
# Tests for addmultisigaddress's address type behavior is only for legacy wallets.
|
|
|
|
|
# Descriptor wallets do not have addmultsigaddress so these tests are not needed for those.
|
|
|
|
|
# addmultisigaddress with at least 1 uncompressed key should return a legacy address.
|
|
|
|
|
for node in range(4):
|
|
|
|
|
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, uncompressed_2])['address'], True, 'legacy')
|
|
|
|
|
self.test_address(node, self.nodes[node].addmultisigaddress(2, [compressed_1, uncompressed_2])['address'], True, 'legacy')
|
|
|
|
|
self.test_address(node, self.nodes[node].addmultisigaddress(2, [uncompressed_1, compressed_2])['address'], True, 'legacy')
|
|
|
|
|
# addmultisigaddress with all compressed keys should return the appropriate address type (even when the keys are not ours).
|
|
|
|
|
self.test_address(0, self.nodes[0].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'legacy')
|
|
|
|
|
self.test_address(1, self.nodes[1].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
|
|
|
|
|
self.test_address(2, self.nodes[2].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'p2sh-segwit')
|
|
|
|
|
self.test_address(3, self.nodes[3].addmultisigaddress(2, [compressed_1, compressed_2])['address'], True, 'bech32')
|
|
|
|
|
|
|
|
|
|
do_multisigs = [False]
|
|
|
|
|
if not self.options.descriptors:
|
|
|
|
|
do_multisigs.append(True)
|
|
|
|
|
|
|
|
|
|
for explicit_type, multisig, from_node in itertools.product([False, True], do_multisigs, range(4)):
|
|
|
|
|
address_type = None
|
|
|
|
|
if explicit_type and not multisig:
|
|
|
|
|
if from_node == 1:
|
|
|
|
|