aboutsummaryrefslogtreecommitdiff
path: root/src/policy
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-11-25 08:15:08 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-11-25 08:16:19 +0100
commit064c729a964ab8d9df5edda18c8b4a9e075789e6 (patch)
tree176da658c39fa61ba92003947bc1c076dbc4c4dd /src/policy
parent64059b78f59e45cc4200ca76d0af8c6dff8a20d4 (diff)
parentfa3e0da06b491b8c0fa2dbae37682a9112c9deb8 (diff)
downloadbitcoin-064c729a964ab8d9df5edda18c8b4a9e075789e6.tar.xz
Merge bitcoin/bitcoin#23512: policy: Treat taproot as always active
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
Diffstat (limited to 'src/policy')
-rw-r--r--src/policy/policy.cpp11
-rw-r--r--src/policy/policy.h3
2 files changed, 5 insertions, 9 deletions
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp
index fced397e51..2c30b20d5b 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -161,13 +161,13 @@ bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, const CFeeR
*
* Note that only the non-witness portion of the transaction is checked here.
*/
-bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, bool taproot_active)
+bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
{
- if (tx.IsCoinBase())
+ if (tx.IsCoinBase()) {
return true; // Coinbases don't use vin normally
+ }
- for (unsigned int i = 0; i < tx.vin.size(); i++)
- {
+ for (unsigned int i = 0; i < tx.vin.size(); i++) {
const CTxOut& prev = mapInputs.AccessCoin(tx.vin[i].prevout).out;
std::vector<std::vector<unsigned char> > vSolutions;
@@ -189,9 +189,6 @@ bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs,
if (subscript.GetSigOpCount(true) > MAX_P2SH_SIGOPS) {
return false;
}
- } else if (whichType == TxoutType::WITNESS_V1_TAPROOT) {
- // Don't allow Taproot spends unless Taproot is active.
- if (!taproot_active) return false;
}
}
diff --git a/src/policy/policy.h b/src/policy/policy.h
index f2a3f35546..f6ac6500f6 100644
--- a/src/policy/policy.h
+++ b/src/policy/policy.h
@@ -105,10 +105,9 @@ bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, const CFeeR
/**
* Check for standard transaction types
* @param[in] mapInputs Map of previous transactions that have outputs we're spending
-* @param[in] taproot_active Whether or taproot consensus rules are active (used to decide whether spends of them are permitted)
* @return True if all inputs (scriptSigs) use only standard transaction forms
*/
-bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs, bool taproot_active);
+bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
/**
* Check if the transaction is over standard P2WSH resources limit:
* 3600bytes witnessScript size, 80bytes per witness stack element, 100 witness stack elements