|
|
@ -31,7 +31,7 @@ |
|
|
|
* DUP CHECKSIG DROP ... repeated 100 times... OP_1 |
|
|
|
* DUP CHECKSIG DROP ... repeated 100 times... OP_1 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType) |
|
|
|
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::vector<unsigned char> > vSolutions; |
|
|
|
std::vector<std::vector<unsigned char> > vSolutions; |
|
|
|
if (!Solver(scriptPubKey, whichType, vSolutions)) |
|
|
|
if (!Solver(scriptPubKey, whichType, vSolutions)) |
|
|
@ -50,10 +50,13 @@ bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType) |
|
|
|
(!fAcceptDatacarrier || scriptPubKey.size() > nMaxDatacarrierBytes)) |
|
|
|
(!fAcceptDatacarrier || scriptPubKey.size() > nMaxDatacarrierBytes)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (!witnessEnabled && (whichType == TX_WITNESS_V0_KEYHASH || whichType == TX_WITNESS_V0_SCRIPTHASH)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
return whichType != TX_NONSTANDARD; |
|
|
|
return whichType != TX_NONSTANDARD; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool IsStandardTx(const CTransaction& tx, std::string& reason) |
|
|
|
bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) { |
|
|
|
if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) { |
|
|
|
reason = "version"; |
|
|
|
reason = "version"; |
|
|
@ -92,7 +95,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason) |
|
|
|
unsigned int nDataOut = 0; |
|
|
|
unsigned int nDataOut = 0; |
|
|
|
txnouttype whichType; |
|
|
|
txnouttype whichType; |
|
|
|
BOOST_FOREACH(const CTxOut& txout, tx.vout) { |
|
|
|
BOOST_FOREACH(const CTxOut& txout, tx.vout) { |
|
|
|
if (!::IsStandard(txout.scriptPubKey, whichType)) { |
|
|
|
if (!::IsStandard(txout.scriptPubKey, whichType, witnessEnabled)) { |
|
|
|
reason = "scriptpubkey"; |
|
|
|
reason = "scriptpubkey"; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|