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:
@ -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