aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_taproot.py
diff options
context:
space:
mode:
authorW. J. van der Laan <laanwj@protonmail.com>2021-06-24 13:44:31 +0200
committerW. J. van der Laan <laanwj@protonmail.com>2021-06-24 14:20:28 +0200
commit0553d75268a94630225fa754841e28d88d751665 (patch)
tree36c9545064ab938751b79ae5b54c0ec9c0e139ff /test/functional/wallet_taproot.py
parentb7565c708dc1c334aea12ab91a7c67695af802f8 (diff)
parent754f134a50cc56cdf0baf996d909c992770fcc97 (diff)
downloadbitcoin-0553d75268a94630225fa754841e28d88d751665.tar.xz
Merge bitcoin/bitcoin#22154: Add OutputType::BECH32M and related wallet support for fetching bech32m addresses
754f134a50cc56cdf0baf996d909c992770fcc97 wallet: Add error message to GetReservedDestination (Andrew Chow) 87a0e7a3b7c0ffd545e537bd497cdc3e67d045f6 Disallow bech32m addresses for legacy wallet things (Andrew Chow) 6dbe4d10728f882986ed0d9ed77bc736f051c662 Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDests (Andrew Chow) 699dfcd8ad9487a4e04c1ffc68211e84e126b3d2 Opportunistically use bech32m change addresses if available (Andrew Chow) 0262536c34567743e527dad46912c9ba493252cd Add OutputType::BECH32M (Andrew Chow) 177c15d2f7cd5406ddbce8217fc023057539b828 Limit LegacyScriptPubKeyMan address types (Andrew Chow) Pull request description: Currently bech32m addresses are classfied as bech32. Because bech32m is incompatible with bech32, we need to define a new `OutputType` for it so that it can be handled correctly. This PR adds `OutputType::BECH32M`, updates all of the relevant `OutputType` classifications, and handle requests for bech32m addresses. There is now a `bech32m` address type string that can be used. * `tr()` descriptors now report their output type as `OutputType::BECH32M`. `WtinessV1Taproot` and `WitnessUnknown` are also classified as `OutputType::BECH32M`. * Bech32m addresses are completely disabled for legacy wallets. They cannot be imported (explicitly disallowed in `importaddress` and `importmulti`), will not be created when getting all destinations for a pubkey, and will not be added with `addmultisigaddress`. Additional protections have been added to `LegacyScriptPubKeyMan` to disallow attempting to retrieve bech32m addresses. * Since Taproot multisigs are not implemented yet, `createmultisig` will also disallow the bech32m address type. * As Taproot is not yet active, `DescriptorScriptPubKeyMan` cannot and will not create a `tr()` descriptor. Protections have been added to make sure this cannot occur. * The change address type detection algorithm has been updated to return `bech32m` when there is a segwit v1+ output script and the wallet has a bech32m `ScriptPubKeyMan`, falling back to bech32 if one is not available. ACKs for top commit: laanwj: re-review ACK 754f134a50cc56cdf0baf996d909c992770fcc97 Sjors: re-utACK 754f134: only change is switching to `bech32m` in two `wallet_taproot.py` test cases. fjahr: re-ACK 754f134a50cc56cdf0baf996d909c992770fcc97 jonatack: ACK 754f134a50cc56cdf0baf996d909c992770fcc97 Tree-SHA512: 6ea90867d3631d0d438e2b08ce6ed930f37d01323224661e8e38f183ea5ee2ab65b5891394a3612c7382a1aff907b457616c6725665a10c320174017b998ca9f
Diffstat (limited to 'test/functional/wallet_taproot.py')
-rwxr-xr-xtest/functional/wallet_taproot.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/functional/wallet_taproot.py b/test/functional/wallet_taproot.py
index 0eac814c52..9eb204bf37 100755
--- a/test/functional/wallet_taproot.py
+++ b/test/functional/wallet_taproot.py
@@ -226,7 +226,7 @@ class WalletTaprootTest(BitcoinTestFramework):
result = self.addr_gen.importdescriptors([{"desc": desc_pub, "active": True, "timestamp": "now"}])
assert(result[0]['success'])
for i in range(4):
- addr_g = self.addr_gen.getnewaddress(address_type='bech32')
+ addr_g = self.addr_gen.getnewaddress(address_type='bech32m')
if treefn is not None:
addr_r = self.make_addr(treefn, keys, i)
assert_equal(addr_g, addr_r)
@@ -265,7 +265,7 @@ class WalletTaprootTest(BitcoinTestFramework):
result = self.rpc_online.importdescriptors([{"desc": desc_change, "active": True, "timestamp": "now", "internal": True}])
assert(result[0]['success'])
for i in range(4):
- addr_g = self.rpc_online.getnewaddress(address_type='bech32')
+ addr_g = self.rpc_online.getnewaddress(address_type='bech32m')
if treefn is not None:
addr_r = self.make_addr(treefn, keys_pay, i)
assert_equal(addr_g, addr_r)
@@ -296,7 +296,7 @@ class WalletTaprootTest(BitcoinTestFramework):
result = self.psbt_offline.importdescriptors([{"desc": desc_change, "active": True, "timestamp": "now", "internal": True}])
assert(result[0]['success'])
for i in range(4):
- addr_g = self.psbt_online.getnewaddress(address_type='bech32')
+ addr_g = self.psbt_online.getnewaddress(address_type='bech32m')
if treefn is not None:
addr_r = self.make_addr(treefn, keys_pay, i)
assert_equal(addr_g, addr_r)