From fa34426ab1146b602ea021ae8a5c1899fd738147 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 13 Mar 2018 12:20:07 -0400 Subject: [PATCH] remove witnessEnabled standardness logic --- src/policy/policy.cpp | 9 +++------ src/policy/policy.h | 4 ++-- src/validation.cpp | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 15ff49d3cc..e55a241ed3 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -33,7 +33,7 @@ CAsset policyAsset; * DUP CHECKSIG DROP ... repeated 100 times... OP_1 */ -bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled) +bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType) { std::vector > vSolutions; if (!Solver(scriptPubKey, whichType, vSolutions)) @@ -54,13 +54,10 @@ bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool w else if (whichType == TX_TRUE) return false; - else if (!witnessEnabled && (whichType == TX_WITNESS_V0_KEYHASH || whichType == TX_WITNESS_V0_SCRIPTHASH)) - return false; - return whichType != TX_NONSTANDARD; } -bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled) +bool IsStandardTx(const CTransaction& tx, std::string& reason) { if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) { reason = "version"; @@ -87,7 +84,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes txnouttype whichType; BOOST_FOREACH(const CTxOut& txout, tx.vout) { - if (!::IsStandard(txout.scriptPubKey, whichType, witnessEnabled) && !txout.IsFee()) { + if (!::IsStandard(txout.scriptPubKey, whichType) && !txout.IsFee()) { reason = "scriptpubkey"; return false; } diff --git a/src/policy/policy.h b/src/policy/policy.h index c9b9a75b59..0fab24c026 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -77,12 +77,12 @@ static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_ static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE | LOCKTIME_MEDIAN_TIME_PAST; -bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled = false); +bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType); /** * Check for standard transaction types * @return True if all outputs (scriptPubKeys) use only standard transaction forms */ -bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled = false); +bool IsStandardTx(const CTransaction& tx, std::string& reason); /** * Check for standard transaction types * @param[in] mapInputs Map of previous transactions that have outputs we're spending diff --git a/src/validation.cpp b/src/validation.cpp index 4f6a318e41..99d76246c9 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1075,7 +1075,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C // Rather not work on nonstandard transactions (unless -testnet/-regtest) std::string reason; - if (fRequireStandard && !IsStandardTx(tx, reason, witnessEnabled)) + if (fRequireStandard && !IsStandardTx(tx, reason)) return state.DoS(0, false, REJECT_NONSTANDARD, reason); // Only accept nLockTime-using transactions that can be mined in the next