0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-06 10:18:44 -05:00
bitcoin-bitcoin-core/src/script
W. J. van der Laan 0553d75268
Merge bitcoin/bitcoin#22154: Add OutputType::BECH32M and related wallet support for fetching bech32m addresses
754f134a50 wallet: Add error message to GetReservedDestination (Andrew Chow)
87a0e7a3b7 Disallow bech32m addresses for legacy wallet things (Andrew Chow)
6dbe4d1072 Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDests (Andrew Chow)
699dfcd8ad Opportunistically use bech32m change addresses if available (Andrew Chow)
0262536c34 Add OutputType::BECH32M (Andrew Chow)
177c15d2f7 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 754f134a50
  Sjors:
    re-utACK 754f134: only change is switching to `bech32m` in two `wallet_taproot.py` test cases.
  fjahr:
    re-ACK 754f134a50
  jonatack:
    ACK 754f134a50

Tree-SHA512: 6ea90867d3631d0d438e2b08ce6ed930f37d01323224661e8e38f183ea5ee2ab65b5891394a3612c7382a1aff907b457616c6725665a10c320174017b998ca9f
2021-06-24 14:20:28 +02:00
..
bitcoinconsensus.cpp Make all SignatureChecker explicit about missing data 2021-03-15 17:29:39 -07:00
bitcoinconsensus.h build: test for __declspec(dllexport) in configure 2021-02-12 09:04:16 +08:00
descriptor.cpp Merge bitcoin/bitcoin#22154: Add OutputType::BECH32M and related wallet support for fetching bech32m addresses 2021-06-24 14:20:28 +02:00
descriptor.h refactor: post Optional<> removal cleanups 2021-03-17 14:56:20 +08:00
interpreter.cpp consensus refactor: extract ComputeTapleafHash, ComputeTaprootMerkleRoot 2021-06-18 11:23:17 -07:00
interpreter.h consensus refactor: extract ComputeTapleafHash, ComputeTaprootMerkleRoot 2021-06-18 11:23:17 -07:00
keyorigin.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
script.cpp scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
script.h Implement Tapscript script validation rules (BIP 342) 2020-10-12 17:18:24 -07:00
script_error.cpp Implement Tapscript script validation rules (BIP 342) 2020-10-12 17:18:24 -07:00
script_error.h scripted-diff: Bump copyright headers 2020-12-31 09:45:41 +01:00
sigcache.cpp refactor: Replace &foo[0] with foo.data() 2021-05-04 06:55:31 +02:00
sigcache.h Make all SignatureChecker explicit about missing data 2021-03-15 17:29:39 -07:00
sign.cpp Add support for SIGHASH_DEFAULT in RPCs, and make it default 2021-06-12 12:38:17 -07:00
sign.h Basic Taproot signing logic in script/sign.cpp 2021-06-12 12:25:28 -07:00
signingprovider.cpp Add TaprootSpendData data structure, equivalent to script map for P2[W]SH 2021-06-12 12:25:28 -07:00
signingprovider.h Add TaprootSpendData data structure, equivalent to script map for P2[W]SH 2021-06-12 12:25:28 -07:00
standard.cpp script, doc: spelling update 2021-06-23 13:33:18 +02:00
standard.h Taproot descriptor inference 2021-06-18 11:28:47 -07:00