mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 03:01:09 +02: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:
@ -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'")
|
||||
|
||||
|
Reference in New Issue
Block a user