mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
wallet: add taproot support to external signer
This commit is contained in:
parent
5bf65ec66e
commit
796b020c37
3 changed files with 21 additions and 7 deletions
|
@ -81,6 +81,9 @@ bool ExternalSigner::SignTransaction(PartiallySignedTransaction& psbtx, std::str
|
|||
for (const auto& entry : input.hd_keypaths) {
|
||||
if (parsed_m_fingerprint == MakeUCharSpan(entry.second.fingerprint)) return true;
|
||||
}
|
||||
for (const auto& entry : input.m_tap_bip32_paths) {
|
||||
if (parsed_m_fingerprint == MakeUCharSpan(entry.second.second.fingerprint)) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,12 +27,15 @@ def getdescriptors(args):
|
|||
"receive": [
|
||||
"pkh([00000001/44'/1'/" + args.account + "']" + xpub + "/0/*)#vt6w3l3j",
|
||||
"sh(wpkh([00000001/49'/1'/" + args.account + "']" + xpub + "/0/*))#r0grqw5x",
|
||||
"wpkh([00000001/84'/1'/" + args.account + "']" + xpub + "/0/*)#x30uthjs"
|
||||
"wpkh([00000001/84'/1'/" + args.account + "']" + xpub + "/0/*)#x30uthjs",
|
||||
"tr([00000001/86'/1'/" + args.account + "']" + xpub + "/0/*)#sng9rd4t"
|
||||
],
|
||||
"internal": [
|
||||
"pkh([00000001/44'/1'/" + args.account + "']" + xpub + "/1/*)#all0v2p2",
|
||||
"sh(wpkh([00000001/49'/1'/" + args.account + "']" + xpub + "/1/*))#kwx4c3pe",
|
||||
"wpkh([00000001/84'/1'/" + args.account + "']" + xpub + "/1/*)#h92akzzg"
|
||||
"wpkh([00000001/84'/1'/" + args.account + "']" + xpub + "/1/*)#h92akzzg",
|
||||
"tr([00000001/86'/1'/" + args.account + "']" + xpub + "/1/*)#p8dy7c9n"
|
||||
|
||||
]
|
||||
}))
|
||||
|
||||
|
@ -44,7 +47,8 @@ def displayaddress(args):
|
|||
return sys.stdout.write(json.dumps({"error": "Unexpected fingerprint", "fingerprint": args.fingerprint}))
|
||||
|
||||
expected_desc = [
|
||||
"wpkh([00000001/84'/1'/0'/0/0]02c97dc3f4420402e01a113984311bf4a1b8de376cac0bdcfaf1b3ac81f13433c7)#0yneg42r"
|
||||
"wpkh([00000001/84'/1'/0'/0/0]02c97dc3f4420402e01a113984311bf4a1b8de376cac0bdcfaf1b3ac81f13433c7)#0yneg42r",
|
||||
"tr([00000001/86'/1'/0'/0/0]c97dc3f4420402e01a113984311bf4a1b8de376cac0bdcfaf1b3ac81f13433c7)#4vdj9jqk",
|
||||
]
|
||||
if args.desc not in expected_desc:
|
||||
return sys.stdout.write(json.dumps({"error": "Unexpected descriptor", "desc": args.desc}))
|
||||
|
|
|
@ -89,7 +89,7 @@ class WalletSignerTest(BitcoinTestFramework):
|
|||
# )
|
||||
# self.clear_mock_result(self.nodes[1])
|
||||
|
||||
assert_equal(hww.getwalletinfo()["keypoolsize"], 30)
|
||||
assert_equal(hww.getwalletinfo()["keypoolsize"], 40)
|
||||
|
||||
address1 = hww.getnewaddress(address_type="bech32")
|
||||
assert_equal(address1, "bcrt1qm90ugl4d48jv8n6e5t9ln6t9zlpm5th68x4f8g")
|
||||
|
@ -112,6 +112,13 @@ class WalletSignerTest(BitcoinTestFramework):
|
|||
assert_equal(address_info['ismine'], True)
|
||||
assert_equal(address_info['hdkeypath'], "m/44'/1'/0'/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")
|
||||
|
||||
self.log.info('Test walletdisplayaddress')
|
||||
result = hww.walletdisplayaddress(address1)
|
||||
assert_equal(result, {"address": address1})
|
||||
|
@ -124,7 +131,7 @@ class WalletSignerTest(BitcoinTestFramework):
|
|||
self.clear_mock_result(self.nodes[1])
|
||||
|
||||
self.log.info('Prepare mock PSBT')
|
||||
self.nodes[0].sendtoaddress(address1, 1)
|
||||
self.nodes[0].sendtoaddress(address4, 1)
|
||||
self.generate(self.nodes[0], 1)
|
||||
|
||||
# Load private key into wallet to generate a signed PSBT for the mock
|
||||
|
@ -133,14 +140,14 @@ class WalletSignerTest(BitcoinTestFramework):
|
|||
assert mock_wallet.getwalletinfo()['private_keys_enabled']
|
||||
|
||||
result = mock_wallet.importdescriptors([{
|
||||
"desc": "wpkh([00000001/84'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0/*)#rweraev0",
|
||||
"desc": "tr([00000001/86'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0/*)#0jtt2jc9",
|
||||
"timestamp": 0,
|
||||
"range": [0,1],
|
||||
"internal": False,
|
||||
"active": True
|
||||
},
|
||||
{
|
||||
"desc": "wpkh([00000001/84'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/*)#j6uzqvuh",
|
||||
"desc": "tr([00000001/86'/1'/0']tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/*)#7xw2h8ga",
|
||||
"timestamp": 0,
|
||||
"range": [0, 0],
|
||||
"internal": True,
|
||||
|
|
Loading…
Add table
Reference in a new issue