aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_taproot.py
AgeCommit message (Collapse)Author
2022-11-10test: Remove wallet option from non-wallet testsMacroFake
Review note: The changes are complete, because self.options.descriptors is set to None in parse_args (test_framework.py). A value of None implies -disablewallet, see the previous commit. So if a call to add_wallet_options is missing, it will lead to a test failure when the wallet is compiled in.
2022-11-04Merge bitcoin/bitcoin#26418: Fix signing of multi_a and rawtr scripts with ↵fanquake
wallets that only have corresponding keys 0de30ed509a9969cb254e00097671625c9e107d2 tests: Test Taproot PSBT signing with keys in other descriptor (Andrew Chow) 6efcdf6b7f6daa83b5937aa630fce358fdaed333 tests: Use new wallets for each test in wallet_taproot.py (Andrew Chow) 8781a1b6bbd0af3cfdf1421fd18de5432494619a psbt: Include output pubkey in additional pubkeys to sign (Andrew Chow) 323890d0d7db2628f9dc6eaeba6e99ce0a12e1f5 sign: Fill in taproot pubkey info for all script path sigs (Andrew Chow) Pull request description: A user reported on [stackexchange](https://bitcoin.stackexchange.com/q/115742/48884) that they were unable to sign for a `multi_a` script using a wallet that only had the corresponding keys (i.e. it did not have the `multi_a()` descriptor). This PR fixes this issue. Additionally, `wallet_taproot.py` is modified to test for this scenario by having another wallet in `do_test_psbt` which contains descriptors that only have the keys involved in the descriptor being tested. `wallet_taproot.py` was also modified to create new wallets for each test case rather than sharing wallets throughout as the sharing could result in the signing wallet having the keys in a different descriptor and accidentally result in failing to detect a test failure. The changes to the test also revealed a similar issue with `rawtr()` descriptors, which has also been fixed by checking if a descriptor can produce a `SigningProvider` for the Taproot output pubkey. ACKs for top commit: instagibbs: crACK https://github.com/bitcoin/bitcoin/pull/26418/commits/0de30ed509a9969cb254e00097671625c9e107d2 darosior: ACK 0de30ed509a9969cb254e00097671625c9e107d2 Tree-SHA512: 12e131dd8afd93da7b1288c9054de2415a228d4477b97102da3ee4e82ce9de20b186260c3085a4b7b067bd8b74400751dcadf153f113db83abc59e7466e69f14
2022-11-01test: remove unused `CHANGE_{XPRV,XPUB}` constantsSebastian Falbesoner
These constants exist since the introduction of the functional test wallet_taproot.py (2667366aaa69447a9de4d819669d254a5ebd4d4b), but they have never been used.
2022-10-28tests: Test Taproot PSBT signing with keys in other descriptorAndrew Chow
Test that the same keys included in other descriptors will still be able to sign a PSBT that requires those keys.
2022-10-28tests: Use new wallets for each test in wallet_taproot.pyAndrew Chow
To avoid a wallet potentially being able to sign a transaction using keys from descriptors imported in previous tests, make new wallets for each test case rather than sharing them.
2022-07-19Add wallet tests for spending rawtr()Pieter Wuille
2022-06-27test: Test signing psbts without explicitly having scriptsAndrew Chow
2022-06-27psbt, test: Check for taproot fields in taproot psbt testAndrew Chow
2022-06-27taproot: Use pre-existing signatures if availableAndrew Chow
Actually use pre-existing signatures in CreateTaprootScriptSig if a signature is found for the given key and leaf hash.
2022-06-14test: add helpers for creating P2TR scripts/addresses from output keySebastian Falbesoner
2022-05-17test: use sendall in wallet_taproot.py testsishaanam
Fixes #25129 (subtractfeefromamount=true fails with insufficient funds)
2022-04-19test: Remove unused taproot node from wallet_taproot.pyMarcoFalke
2022-03-09Merge bitcoin/bitcoin#24490: tests: Ensure sorted/multi_a descriptors always ↵MarcoFalke
generate different addrs db27ac935480aeec40a1cfc9d5f10a48be55d61b tests: Ensure sorted/multi_a descriptors always generate different addrs (Andrew Chow) Pull request description: Sometimes the multi_a and sortedmulti_a descriptors will produce some of the same addresses in the tests. This causes the wallets to start generating addresses at a different index as they detect that one of the addresses is used. This subsequently causes a test failure. To avoid this problem, use descriptors that will produce unique addresses by putting one of the multi_a in a different branch. ACKs for top commit: ajtowns: ACK db27ac935480aeec40a1cfc9d5f10a48be55d61b theStack: Tested ACK db27ac935480aeec40a1cfc9d5f10a48be55d61b Tree-SHA512: 0f57822bf4c7c79da304f092d7d43d6118e78a087cbeb0766fbbf634dc27911ae723d5d41350884d3b63a24d3b3817944f7e5fa534afb849161dd008a1e4a62f
2022-03-07test: refactor: use `random.sample` for choosing random keys in ↵Sebastian Falbesoner
wallet_taproot.py
2022-03-07tests: Ensure sorted/multi_a descriptors always generate different addrsAndrew Chow
Sometimes the multi_a and sortedmulti_a descriptors will produce some of the same addresses in the tests. This causes the wallets to start generating addresses at a different index as they detect that one of the addresses is used. This subsequently causes a test failure. To avoid this problem, use descriptors that will produce unique addresses by putting one of the multi_a in a different branch.
2022-01-12Simplify wallet_taproot.py functional testPieter Wuille
2022-01-12Add tests for (sorted)multi_a derivation/signingPieter Wuille
2021-11-25Merge bitcoin/bitcoin#23512: policy: Treat taproot as always activeMarcoFalke
fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 policy: Treat taproot as always active (MarcoFalke) Pull request description: Now that taproot is active, it can be treated as if it was always active for policy for the next major release. This simplifies the code and changes two things: * Importing `tr` descriptors can be done before the chain is fully synced. This is fine, because the wallet will already generate `tr` descriptors by default (regardless of the taproot status) after commit 47fe7445e7f54aee10ec6dbc53f1db1adbeb43de. * Valid taproot spends won't be rejected from the mempool before taproot is active. This is strictly speaking a bugfix after commit 47fe7445e7f54aee10ec6dbc53f1db1adbeb43de, since the wallet may generate taproot spends before the chain is fully synced. For example, a slow node or a purposefully offline node. Currently, the wallet needs the mempool to account for change. See https://github.com/bitcoin/bitcoin/issues/11887. A similar change was done for segwit v0 in https://github.com/bitcoin/bitcoin/pull/13120 . This effectively reverts commit c5ec0367d718544caa3a1578d6c730fc92ee4e94. ACKs for top commit: mjdietzx: Code Review ACK fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 achow101: ACK fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 sipa: utACK fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 gruve-p: ACK https://github.com/bitcoin/bitcoin/pull/23512/commits/fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 gunar: Code Review + tACK fa3e0da06 rajarshimaitra: code review + tACK https://github.com/bitcoin/bitcoin/pull/23512/commits/fa3e0da06b491b8c0fa2dbae37682a9112c9deb8 Tree-SHA512: c6dc7a4e6c345bdec33f256847dc63906ab1696aa683ab9b32a79e715613950884ac3a1a7a44e95f31bb28e58dd64679a616175f7e152b21f5550f3337c8e622
2021-11-17test: refactor: replace OP_1/OP_TRUE magic numbers by constantsSebastian Falbesoner
2021-11-16policy: Treat taproot as always activeMarcoFalke
2021-10-29test: Implicitly sync after generate*, unless opted outMarcoFalke
2021-10-20Make explicit the node param in init_wallet()lsilva01
2021-09-02scripted-diff: Use generate* from TestFrameworkMarcoFalke
-BEGIN VERIFY SCRIPT- sed --regexp-extended -i \ 's/((self\.)?(nodes\[[^]]+\]|[a-z_]*(wallet|node)[0-9a-z_]*))\.(generate(|toaddress|block|todescriptor)(\(|, ))/self.\5\1, /g' \ $(git grep -l generate ./test | grep -v 'test_framework/' | grep -v 'feature_rbf') -END VERIFY SCRIPT-
2021-06-24Merge bitcoin/bitcoin#22154: Add OutputType::BECH32M and related wallet ↵W. J. van der Laan
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
2021-06-22Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDestsAndrew Chow
The tr() descriptor, WitnessV1Taproot CTxDestination, and WitnessUnknown CTxDestination are OutputType::BECH32M so they should report as such.
2021-06-18Taproot descriptor inferencePieter Wuille
2021-06-12tests: check spending of P2TRPieter Wuille
2021-06-10Allow tr() import only when Taproot is activeAndrew Chow
To avoid issues around fund loss, only allow descriptor wallets to import tr() descriptors after taproot has activated.
2021-05-24tests: check derivation of P2TRPieter Wuille