mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-28 14:22:47 +02:00
Merge bitcoin/bitcoin#26076: Switch hardened derivation marker to h
fe49f06c0e
doc: clarify PR 26076 release note (Sjors Provoost)bd13dc2f46
Switch hardened derivation marker to h in descriptors (Sjors Provoost) Pull request description: This makes it easier to handle descriptor strings manually, especially when importing from another Bitcoin Core wallet. For example the `importdescriptors` RPC call is easiest to use `h` as the marker: `'["desc": ".../0h/..."]'`, avoiding the need for escape characters. With this change `listdescriptors` will use `h`, so you can copy-paste the result, without having to add escape characters or switch `'` to 'h' manually. Both markers can still be parsed. The `hdkeypath` field in `getaddressinfo` is also impacted by this change, except for legacy wallets. The latter is to prevent accidentally breaking ancient software that uses our legacy wallet. See discussion in #15740 ACKs for top commit: achow101: ACKfe49f06c0e
darosior: re-ACKfe49f06c0e
Tree-SHA512: f78bc873b24a6f7a2bf38f5dd58f2b723e35e6b10e4d65c36ec300e2d362d475eeca6e5afa04b3037ab4bee0bf8ebc93ea5fc18102a2111d3d88fc873c08dc89
This commit is contained in:
@@ -332,15 +332,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()
|
||||
|
Reference in New Issue
Block a user