mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-28 08:25:59 +01:00
Switch hardened derivation marker to h in descriptors
This makes it easier to handle descriptor strings manually. E.g. an RPC call that takes an array of descriptors can now use '["desc": ".../0h/..."]'. Both markers can still be parsed. The default for new descriptors is changed to h. In normalized form h is also used. For private keys the chosen marker is preserved in a round trip. The hdkeypath field in getaddressinfo is also impacted by this change.
This commit is contained in:
@@ -55,9 +55,9 @@ class DescriptorTest(BitcoinTestFramework):
|
||||
# A P2PK output with the public key of the specified xpub.
|
||||
self.test_desc('pk(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B)', isrange=False, issolvable=True, hasprivatekeys=False)
|
||||
# A P2PKH output with child key *1'/2* of the specified xpub.
|
||||
self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1'/2)", isrange=False, issolvable=True, hasprivatekeys=False)
|
||||
self.test_desc("pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1h/2)", isrange=False, issolvable=True, hasprivatekeys=False)
|
||||
# A set of P2PKH outputs, but additionally specifies that the specified xpub is a child of a master with fingerprint `d34db33f`, and derived using path `44'/0'/0'`.
|
||||
self.test_desc("pkh([d34db33f/44'/0'/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/*)", isrange=True, issolvable=True, hasprivatekeys=False)
|
||||
self.test_desc("pkh([d34db33f/44h/0h/0h]tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/*)", isrange=True, issolvable=True, hasprivatekeys=False)
|
||||
# A set of *1-of-2* P2WSH multisig outputs where the first multisig key is the *1/0/`i`* child of the first specified xpub and the second multisig key is the *0/0/`i`* child of the second specified xpub, and `i` is any number in a configurable range (`0-1000` by default).
|
||||
self.test_desc("wsh(multi(1,tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/0/*,tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/0/0/*))", isrange=True, issolvable=True, hasprivatekeys=False)
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class ScantxoutsetTest(BitcoinTestFramework):
|
||||
assert_equal(self.nodes[0].scantxoutset("start", [{"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": [1500, 1500]}])['total_amount'], Decimal("16.384"))
|
||||
|
||||
# Test the reported descriptors for a few matches
|
||||
assert_equal(descriptors(self.nodes[0].scantxoutset("start", [{"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/*)", "range": 1499}])), ["pkh([0c5f9a1e/0'/0'/0]026dbd8b2315f296d36e6b6920b1579ca75569464875c7ebe869b536a7d9503c8c)#dzxw429x", "pkh([0c5f9a1e/0'/0'/1]033e6f25d76c00bedb3a8993c7d5739ee806397f0529b1b31dda31ef890f19a60c)#43rvceed"])
|
||||
assert_equal(descriptors(self.nodes[0].scantxoutset("start", [{"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0h/*)", "range": 1499}])), ["pkh([0c5f9a1e/0h/0h/0]026dbd8b2315f296d36e6b6920b1579ca75569464875c7ebe869b536a7d9503c8c)#rthll0rg", "pkh([0c5f9a1e/0h/0h/1]033e6f25d76c00bedb3a8993c7d5739ee806397f0529b1b31dda31ef890f19a60c)#mcjajulr"])
|
||||
assert_equal(descriptors(self.nodes[0].scantxoutset("start", ["combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0)"])), ["pkh([0c5f9a1e/1/1/0]03e1c5b6e650966971d7e71ef2674f80222752740fc1dfd63bbbd220d2da9bd0fb)#cxmct4w8"])
|
||||
assert_equal(descriptors(self.nodes[0].scantxoutset("start", [{"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": 1500}])), ['pkh([0c5f9a1e/1/1/0]03e1c5b6e650966971d7e71ef2674f80222752740fc1dfd63bbbd220d2da9bd0fb)#cxmct4w8', 'pkh([0c5f9a1e/1/1/1500]03832901c250025da2aebae2bfb38d5c703a57ab66ad477f9c578bfbcd78abca6f)#vchwd07g', 'pkh([0c5f9a1e/1/1/1]030d820fc9e8211c4169be8530efbc632775d8286167afd178caaf1089b77daba7)#z2t3ypsa'])
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ class AddressTypeTest(BitcoinTestFramework):
|
||||
for deriv in decode['inputs'][0]['bip32_derivs']:
|
||||
assert_equal(len(deriv['master_fingerprint']), 8)
|
||||
assert_equal(deriv['path'][0], 'm')
|
||||
key_descs[deriv['pubkey']] = '[' + deriv['master_fingerprint'] + deriv['path'][1:] + ']' + deriv['pubkey']
|
||||
key_descs[deriv['pubkey']] = '[' + deriv['master_fingerprint'] + deriv['path'][1:].replace("'","h") + ']' + deriv['pubkey']
|
||||
|
||||
# Verify the descriptor checksum against the Python implementation
|
||||
assert descsum_check(info['desc'])
|
||||
|
||||
@@ -253,7 +253,7 @@ class BackwardsCompatibilityTest(BitcoinTestFramework):
|
||||
wallet = node_v17.get_wallet_rpc("u1_v17")
|
||||
address = wallet.getnewaddress("bech32")
|
||||
v17_info = wallet.getaddressinfo(address)
|
||||
hdkeypath = v17_info["hdkeypath"]
|
||||
hdkeypath = v17_info["hdkeypath"].replace("'", "h")
|
||||
pubkey = v17_info["pubkey"]
|
||||
|
||||
if self.is_bdb_compiled():
|
||||
|
||||
@@ -60,43 +60,43 @@ class WalletDescriptorTest(BitcoinTestFramework):
|
||||
addr = self.nodes[0].getnewaddress("", "legacy")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('pkh(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/44\'/1\'/0\'/0/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/44h/1h/0h/0/0')
|
||||
|
||||
addr = self.nodes[0].getnewaddress("", "p2sh-segwit")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('sh(wpkh(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/49\'/1\'/0\'/0/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/49h/1h/0h/0/0')
|
||||
|
||||
addr = self.nodes[0].getnewaddress("", "bech32")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('wpkh(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/84\'/1\'/0\'/0/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/84h/1h/0h/0/0')
|
||||
|
||||
addr = self.nodes[0].getnewaddress("", "bech32m")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('tr(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/86\'/1\'/0\'/0/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/86h/1h/0h/0/0')
|
||||
|
||||
# Check that getrawchangeaddress works
|
||||
addr = self.nodes[0].getrawchangeaddress("legacy")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('pkh(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/44\'/1\'/0\'/1/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/44h/1h/0h/1/0')
|
||||
|
||||
addr = self.nodes[0].getrawchangeaddress("p2sh-segwit")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('sh(wpkh(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/49\'/1\'/0\'/1/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/49h/1h/0h/1/0')
|
||||
|
||||
addr = self.nodes[0].getrawchangeaddress("bech32")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('wpkh(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/84\'/1\'/0\'/1/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/84h/1h/0h/1/0')
|
||||
|
||||
addr = self.nodes[0].getrawchangeaddress("bech32m")
|
||||
addr_info = self.nodes[0].getaddressinfo(addr)
|
||||
assert addr_info['desc'].startswith('tr(')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/86\'/1\'/0\'/1/0')
|
||||
assert_equal(addr_info['hdkeypath'], 'm/86h/1h/0h/1/0')
|
||||
|
||||
# Make a wallet to receive coins at
|
||||
self.nodes[0].createwallet(wallet_name="desc2", descriptors=True)
|
||||
@@ -178,14 +178,14 @@ class WalletDescriptorTest(BitcoinTestFramework):
|
||||
self.nodes[0].createwallet(wallet_name='desc_import', disable_private_keys=True, descriptors=True)
|
||||
imp_rpc = self.nodes[0].get_wallet_rpc('desc_import')
|
||||
|
||||
addr_types = [('legacy', False, 'pkh(', '44\'/1\'/0\'', -13),
|
||||
('p2sh-segwit', False, 'sh(wpkh(', '49\'/1\'/0\'', -14),
|
||||
('bech32', False, 'wpkh(', '84\'/1\'/0\'', -13),
|
||||
('bech32m', False, 'tr(', '86\'/1\'/0\'', -13),
|
||||
('legacy', True, 'pkh(', '44\'/1\'/0\'', -13),
|
||||
('p2sh-segwit', True, 'sh(wpkh(', '49\'/1\'/0\'', -14),
|
||||
('bech32', True, 'wpkh(', '84\'/1\'/0\'', -13),
|
||||
('bech32m', True, 'tr(', '86\'/1\'/0\'', -13)]
|
||||
addr_types = [('legacy', False, 'pkh(', '44h/1h/0h', -13),
|
||||
('p2sh-segwit', False, 'sh(wpkh(', '49h/1h/0h', -14),
|
||||
('bech32', False, 'wpkh(', '84h/1h/0h', -13),
|
||||
('bech32m', False, 'tr(', '86h/1h/0h', -13),
|
||||
('legacy', True, 'pkh(', '44h/1h/0h', -13),
|
||||
('p2sh-segwit', True, 'sh(wpkh(', '49h/1h/0h', -14),
|
||||
('bech32', True, 'wpkh(', '84h/1h/0h', -13),
|
||||
('bech32m', True, 'tr(', '86h/1h/0h', -13)]
|
||||
|
||||
for addr_type, internal, desc_prefix, deriv_path, int_idx in addr_types:
|
||||
int_str = 'internal' if internal else 'external'
|
||||
|
||||
@@ -41,7 +41,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
change_addr = self.nodes[1].getrawchangeaddress()
|
||||
change_addrV = self.nodes[1].getaddressinfo(change_addr)
|
||||
if self.options.descriptors:
|
||||
assert_equal(change_addrV["hdkeypath"], "m/84'/1'/0'/1/0")
|
||||
assert_equal(change_addrV["hdkeypath"], "m/84h/1h/0h/1/0")
|
||||
else:
|
||||
assert_equal(change_addrV["hdkeypath"], "m/0'/1'/0'") #first internal child key
|
||||
|
||||
@@ -63,7 +63,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
hd_add = self.nodes[1].getnewaddress()
|
||||
hd_info = self.nodes[1].getaddressinfo(hd_add)
|
||||
if self.options.descriptors:
|
||||
assert_equal(hd_info["hdkeypath"], "m/84'/1'/0'/0/" + str(i))
|
||||
assert_equal(hd_info["hdkeypath"], "m/84h/1h/0h/0/" + str(i))
|
||||
else:
|
||||
assert_equal(hd_info["hdkeypath"], "m/0'/0'/" + str(i) + "'")
|
||||
assert_equal(hd_info["hdmasterfingerprint"], hd_fingerprint)
|
||||
@@ -76,7 +76,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
change_addr = self.nodes[1].getrawchangeaddress()
|
||||
change_addrV = self.nodes[1].getaddressinfo(change_addr)
|
||||
if self.options.descriptors:
|
||||
assert_equal(change_addrV["hdkeypath"], "m/84'/1'/0'/1/1")
|
||||
assert_equal(change_addrV["hdkeypath"], "m/84h/1h/0h/1/1")
|
||||
else:
|
||||
assert_equal(change_addrV["hdkeypath"], "m/0'/1'/1'") #second internal child key
|
||||
|
||||
@@ -101,7 +101,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
hd_add_2 = self.nodes[1].getnewaddress()
|
||||
hd_info_2 = self.nodes[1].getaddressinfo(hd_add_2)
|
||||
if self.options.descriptors:
|
||||
assert_equal(hd_info_2["hdkeypath"], "m/84'/1'/0'/0/" + str(i))
|
||||
assert_equal(hd_info_2["hdkeypath"], "m/84h/1h/0h/0/" + str(i))
|
||||
else:
|
||||
assert_equal(hd_info_2["hdkeypath"], "m/0'/0'/" + str(i) + "'")
|
||||
assert_equal(hd_info_2["hdmasterfingerprint"], hd_fingerprint)
|
||||
@@ -143,7 +143,7 @@ class WalletHDTest(BitcoinTestFramework):
|
||||
keypath = self.nodes[1].getaddressinfo(out['scriptPubKey']['address'])['hdkeypath']
|
||||
|
||||
if self.options.descriptors:
|
||||
assert_equal(keypath[0:14], "m/84'/1'/0'/1/")
|
||||
assert_equal(keypath[0:14], "m/84h/1h/0h/1/")
|
||||
else:
|
||||
assert_equal(keypath[0:7], "m/0'/1'")
|
||||
|
||||
|
||||
@@ -329,15 +329,15 @@ class ImportDescriptorsTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-4, 'This wallet has no available keys', w1.getrawchangeaddress, 'bech32')
|
||||
assert_equal(received_addr, expected_addr)
|
||||
bech32_addr_info = w1.getaddressinfo(received_addr)
|
||||
assert_equal(bech32_addr_info['desc'][:23], 'wpkh([80002067/0\'/0\'/{}]'.format(i))
|
||||
assert_equal(bech32_addr_info['desc'][:23], 'wpkh([80002067/0h/0h/{}]'.format(i))
|
||||
|
||||
shwpkh_addr = w1.getnewaddress('', 'p2sh-segwit')
|
||||
shwpkh_addr_info = w1.getaddressinfo(shwpkh_addr)
|
||||
assert_equal(shwpkh_addr_info['desc'][:26], 'sh(wpkh([abcdef12/0\'/0\'/{}]'.format(i))
|
||||
assert_equal(shwpkh_addr_info['desc'][:26], 'sh(wpkh([abcdef12/0h/0h/{}]'.format(i))
|
||||
|
||||
pkh_addr = w1.getnewaddress('', 'legacy')
|
||||
pkh_addr_info = w1.getaddressinfo(pkh_addr)
|
||||
assert_equal(pkh_addr_info['desc'][:22], 'pkh([12345678/0\'/0\'/{}]'.format(i))
|
||||
assert_equal(pkh_addr_info['desc'][:22], 'pkh([12345678/0h/0h/{}]'.format(i))
|
||||
|
||||
assert_equal(w1.getwalletinfo()['keypoolsize'], 4 * 3) # After retrieving a key, we don't refill the keypool again, so it's one less for each address type
|
||||
w1.keypoolrefill()
|
||||
|
||||
@@ -83,11 +83,11 @@ class KeypoolRestoreTest(BitcoinTestFramework):
|
||||
# Check that we have marked all keys up to the used keypool key as used
|
||||
if self.options.descriptors:
|
||||
if output_type == 'legacy':
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/44'/1'/0'/0/110")
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/44h/1h/0h/0/110")
|
||||
elif output_type == 'p2sh-segwit':
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/49'/1'/0'/0/110")
|
||||
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/84'/1'/0'/0/110")
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/84h/1h/0h/0/110")
|
||||
else:
|
||||
assert_equal(self.nodes[idx].getaddressinfo(self.nodes[idx].getnewaddress(address_type=output_type))['hdkeypath'], "m/0'/0'/110'")
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class ListDescriptorsTest(BitcoinTestFramework):
|
||||
self.log.info('Test descriptors with hardened derivations are listed in importable form.')
|
||||
xprv = 'tprv8ZgxMBicQKsPeuVhWwi6wuMQGfPKi9Li5GtX35jVNknACgqe3CY4g5xgkfDDJcmtF7o1QnxWDRYw4H5P26PXq7sbcUkEqeR4fg3Kxp2tigg'
|
||||
xpub_acc = 'tpubDCMVLhErorrAGfApiJSJzEKwqeaf2z3NrkVMxgYQjZLzMjXMBeRw2muGNYbvaekAE8rUFLftyEar4LdrG2wXyyTJQZ26zptmeTEjPTaATts'
|
||||
hardened_path = '/84\'/1\'/0\''
|
||||
hardened_path = '/84h/1h/0h'
|
||||
wallet = node.get_wallet_rpc('w2')
|
||||
wallet.importdescriptors([{
|
||||
'desc': descsum_create('wpkh(' + xprv + hardened_path + '/0/*)'),
|
||||
|
||||
@@ -53,7 +53,7 @@ class WalletMigrationTest(BitcoinTestFramework):
|
||||
assert_equal(addr_info["address"], addr_info_old["address"])
|
||||
assert_equal(addr_info["scriptPubKey"], addr_info_old["scriptPubKey"])
|
||||
assert_equal(addr_info["ismine"], addr_info_old["ismine"])
|
||||
assert_equal(addr_info["hdkeypath"], addr_info_old["hdkeypath"])
|
||||
assert_equal(addr_info["hdkeypath"], addr_info_old["hdkeypath"].replace("'","h"))
|
||||
assert_equal(addr_info["solvable"], addr_info_old["solvable"])
|
||||
assert_equal(addr_info["ischange"], addr_info_old["ischange"])
|
||||
assert_equal(addr_info["hdmasterfingerprint"], addr_info_old["hdmasterfingerprint"])
|
||||
@@ -91,11 +91,11 @@ class WalletMigrationTest(BitcoinTestFramework):
|
||||
self.assert_is_sqlite("basic0")
|
||||
|
||||
# The wallet should create the following descriptors:
|
||||
# * BIP32 descriptors in the form of "0'/0'/*" and "0'/1'/*" (2 descriptors)
|
||||
# * BIP44 descriptors in the form of "44'/1'/0'/0/*" and "44'/1'/0'/1/*" (2 descriptors)
|
||||
# * BIP49 descriptors, P2SH(P2WPKH), in the form of "86'/1'/0'/0/*" and "86'/1'/0'/1/*" (2 descriptors)
|
||||
# * BIP84 descriptors, P2WPKH, in the form of "84'/1'/0'/1/*" and "84'/1'/0'/1/*" (2 descriptors)
|
||||
# * BIP86 descriptors, P2TR, in the form of "86'/1'/0'/0/*" and "86'/1'/0'/1/*" (2 descriptors)
|
||||
# * BIP32 descriptors in the form of "0h/0h/*" and "0h/1h/*" (2 descriptors)
|
||||
# * BIP44 descriptors in the form of "44h/1h/0h/0/*" and "44h/1h/0h/1/*" (2 descriptors)
|
||||
# * BIP49 descriptors, P2SH(P2WPKH), in the form of "86h/1h/0h/0/*" and "86h/1h/0h/1/*" (2 descriptors)
|
||||
# * BIP84 descriptors, P2WPKH, in the form of "84h/1h/0h/1/*" and "84h/1h/0h/1/*" (2 descriptors)
|
||||
# * BIP86 descriptors, P2TR, in the form of "86h/1h/0h/0/*" and "86h/1h/0h/1/*" (2 descriptors)
|
||||
# * A combo(PK) descriptor for the wallet master key.
|
||||
# So, should have a total of 11 descriptors on it.
|
||||
assert_equal(len(basic0.listdescriptors()["descriptors"]), 11)
|
||||
@@ -107,7 +107,7 @@ class WalletMigrationTest(BitcoinTestFramework):
|
||||
self.assert_addr_info_equal(change_addr_info, old_change_addr_info)
|
||||
|
||||
addr_info = basic0.getaddressinfo(basic0.getnewaddress("", "bech32"))
|
||||
assert_equal(addr_info["hdkeypath"], "m/84'/1'/0'/0/0")
|
||||
assert_equal(addr_info["hdkeypath"], "m/84h/1h/0h/0/0")
|
||||
|
||||
self.log.info("Test migration of a basic keys only wallet with a balance")
|
||||
basic1 = self.create_legacy_wallet("basic1")
|
||||
|
||||
@@ -109,28 +109,28 @@ class WalletSignerTest(BitcoinTestFramework):
|
||||
address_info = hww.getaddressinfo(address1)
|
||||
assert_equal(address_info['solvable'], True)
|
||||
assert_equal(address_info['ismine'], True)
|
||||
assert_equal(address_info['hdkeypath'], "m/84'/1'/0'/0/0")
|
||||
assert_equal(address_info['hdkeypath'], "m/84h/1h/0h/0/0")
|
||||
|
||||
address2 = hww.getnewaddress(address_type="p2sh-segwit")
|
||||
assert_equal(address2, "2N2gQKzjUe47gM8p1JZxaAkTcoHPXV6YyVp")
|
||||
address_info = hww.getaddressinfo(address2)
|
||||
assert_equal(address_info['solvable'], True)
|
||||
assert_equal(address_info['ismine'], True)
|
||||
assert_equal(address_info['hdkeypath'], "m/49'/1'/0'/0/0")
|
||||
assert_equal(address_info['hdkeypath'], "m/49h/1h/0h/0/0")
|
||||
|
||||
address3 = hww.getnewaddress(address_type="legacy")
|
||||
assert_equal(address3, "n1LKejAadN6hg2FrBXoU1KrwX4uK16mco9")
|
||||
address_info = hww.getaddressinfo(address3)
|
||||
assert_equal(address_info['solvable'], True)
|
||||
assert_equal(address_info['ismine'], True)
|
||||
assert_equal(address_info['hdkeypath'], "m/44'/1'/0'/0/0")
|
||||
assert_equal(address_info['hdkeypath'], "m/44h/1h/0h/0/0")
|
||||
|
||||
address4 = hww.getnewaddress(address_type="bech32m")
|
||||
assert_equal(address4, "bcrt1phw4cgpt6cd30kz9k4wkpwm872cdvhss29jga2xpmftelhqll62ms4e9sqj")
|
||||
address_info = hww.getaddressinfo(address4)
|
||||
assert_equal(address_info['solvable'], True)
|
||||
assert_equal(address_info['ismine'], True)
|
||||
assert_equal(address_info['hdkeypath'], "m/86'/1'/0'/0/0")
|
||||
assert_equal(address_info['hdkeypath'], "m/86h/1h/0h/0/0")
|
||||
|
||||
self.log.info('Test walletdisplayaddress')
|
||||
result = hww.walletdisplayaddress(address1)
|
||||
@@ -153,14 +153,14 @@ class WalletSignerTest(BitcoinTestFramework):
|
||||
assert mock_wallet.getwalletinfo()['private_keys_enabled']
|
||||
|
||||
result = mock_wallet.importdescriptors([{
|
||||
"desc": "tr([00000001/86'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0/*)#0jtt2jc9",
|
||||
"desc": "tr([00000001/86h/1h/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0/*)#7ew68cn8",
|
||||
"timestamp": 0,
|
||||
"range": [0,1],
|
||||
"internal": False,
|
||||
"active": True
|
||||
},
|
||||
{
|
||||
"desc": "tr([00000001/86'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/*)#7xw2h8ga",
|
||||
"desc": "tr([00000001/86h/1h/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/*)#0dtm6drl",
|
||||
"timestamp": 0,
|
||||
"range": [0, 0],
|
||||
"internal": True,
|
||||
@@ -182,7 +182,7 @@ class WalletSignerTest(BitcoinTestFramework):
|
||||
# hww4 = self.nodes[1].get_wallet_rpc("hww4")
|
||||
#
|
||||
# descriptors = [{
|
||||
# "desc": "wpkh([00000001/84'/1'/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/0/*)#x30uthjs",
|
||||
# "desc": "wpkh([00000001/84h/1h/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/0/*)#x30uthjs",
|
||||
# "timestamp": "now",
|
||||
# "range": [0, 1],
|
||||
# "internal": False,
|
||||
@@ -190,7 +190,7 @@ class WalletSignerTest(BitcoinTestFramework):
|
||||
# "active": True
|
||||
# },
|
||||
# {
|
||||
# "desc": "wpkh([00000001/84'/1'/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/*)#h92akzzg",
|
||||
# "desc": "wpkh([00000001/84h/1h/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/*)#h92akzzg",
|
||||
# "timestamp": "now",
|
||||
# "range": [0, 0],
|
||||
# "internal": True,
|
||||
|
||||
Reference in New Issue
Block a user