aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-10-26 11:02:35 +0800
committerfanquake <fanquake@gmail.com>2022-10-26 11:10:23 +0800
commit28cf75697186ea8e473e120a643994bdf8237d6c (patch)
tree7c82d37f5ec8f1a1110fa8bd5d8efb30eabe1d4f /test/functional
parentbfce05cc341113a1e7c685950b175dee3aaf2354 (diff)
parent796b020c37c793674f9d614d5d70fd1ed65f0938 (diff)
Merge bitcoin/bitcoin#23578: Add external signer taproot support
796b020c37c793674f9d614d5d70fd1ed65f0938 wallet: add taproot support to external signer (Sjors Provoost) Pull request description: Builds on #22558 (merged on 2022-06-28). [HWI 2.1.0](https://github.com/bitcoin-core/HWI/releases/tag/2.1.0) or newer is required to import and use taproot descriptors. Older versions will work, but won't import a taproot descriptor. Tested with HWI 2.1.1: * Trezor T (firmware v2.5.1) on Signet: signs, change detection works * Ledger Nano S (firmware 2.1.0, Bitcoin app 2.0.6): signs, change detection works Only the most basic `tr(key)` descriptor is supported, script path spending is completely untested (if it works at all). ACKs for top commit: jb55: utACK 796b020c37c793674f9d614d5d70fd1ed65f0938 achow101: ACK 796b020c37c793674f9d614d5d70fd1ed65f0938 Tree-SHA512: 6dcb7eeb45421a3bbf2bdabeacd29979867db69077d7bf192bb77faa4bfefe446487b8df07bc40f9457009a88e598bdc09f769e6106fed2833ace7ef205a157a
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/mocks/signer.py10
-rwxr-xr-xtest/functional/wallet_signer.py15
2 files changed, 18 insertions, 7 deletions
diff --git a/test/functional/mocks/signer.py b/test/functional/mocks/signer.py
index c5a8f7b1e9..6699914249 100755
--- a/test/functional/mocks/signer.py
+++ b/test/functional/mocks/signer.py
@@ -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}))
diff --git a/test/functional/wallet_signer.py b/test/functional/wallet_signer.py
index 5609ac9bf5..db3a8a2efa 100755
--- a/test/functional/wallet_signer.py
+++ b/test/functional/wallet_signer.py
@@ -98,7 +98,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")
@@ -121,6 +121,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})
@@ -133,7 +140,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
@@ -142,14 +149,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,