diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index da60080d5..c61c6a12d 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -621,7 +621,7 @@ static void MutateTxSign(CMutableTransaction& tx, const std::string& flagStr) // if redeemScript given and private keys given, // add redeemScript to the tempKeystore so it can be signed: - if ((scriptPubKey.IsPayToScriptHash() || scriptPubKey.IsPayToWitnessScriptHash()) && + if ((scriptPubKey.IsPayToScriptHash(true) || scriptPubKey.IsPayToWitnessScriptHash(true)) && prevOut.exists("redeemScript")) { UniValue v = prevOut["redeemScript"]; std::vector rsData(ParseHexUV(v, "redeemScript")); diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index 620f483c6..45d9c9c35 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -130,7 +130,7 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in const Coin& coin = inputs.AccessCoin(tx.vin[i].prevout); assert(!coin.IsSpent()); const CTxOut &prevout = coin.out; - if (prevout.scriptPubKey.IsPayToScriptHash()) + if (prevout.scriptPubKey.IsPayToScriptHash(true)) nSigOps += prevout.scriptPubKey.GetSigOpCount(tx.vin[i].scriptSig); } return nSigOps; diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index bff58932b..ff90fbebd 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -210,7 +210,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) // get the scriptPubKey corresponding to this input: CScript prevScript = prev.scriptPubKey; - if (prevScript.IsPayToScriptHash()) { + if (prevScript.IsPayToScriptHash(true)) { std::vector > stack; // If the scriptPubKey is P2SH, we try to extract the redeemScript casually by converting the scriptSig // into a stack. We do not check IsPushOnly nor compare the hash as these will be done later anyway. diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 1e79d7046..54a581ce6 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -840,7 +840,7 @@ UniValue signrawtransaction(const JSONRPCRequest& request) // if redeemScript given and not using the local wallet (private keys // given), add redeemScript to the tempKeystore so it can be signed: - if (fGivenKeys && (scriptPubKey.IsPayToScriptHash() || scriptPubKey.IsPayToWitnessScriptHash())) { + if (fGivenKeys && (scriptPubKey.IsPayToScriptHash(true) || scriptPubKey.IsPayToWitnessScriptHash(true))) { RPCTypeCheckObj(prevOut, { {"txid", UniValueType(UniValue::VSTR)}, diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 8b26caef5..0a4417b91 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -99,7 +99,7 @@ bool static IsCompressedPubKey(const valtype &vchPubKey) { * Where R and S are not negative (their first byte has its highest bit not set), and not * excessively padded (do not start with a 0 byte, unless an otherwise negative number follows, * in which case a single 0 byte is necessary and even required). - * + * * See https://bitcointalk.org/index.php?topic=8392.msg127623#msg127623 * * This function is consensus-critical since BIP66. @@ -139,7 +139,7 @@ bool static IsValidSignatureEncoding(const std::vector &sig) { // Verify that the length of the signature matches the sum of the length // of the elements. if ((size_t)(lenR + lenS + 7) != sig.size()) return false; - + // Check whether the R element is an integer. if (sig[2] != 0x02) return false; @@ -869,7 +869,7 @@ bool EvalScript(std::vector >& stack, const CScript& popstack(stack); stack.push_back(vchHash); } - break; + break; case OP_CODESEPARATOR: { @@ -1465,7 +1465,7 @@ bool VerifyScript(const CScript& scriptSig, const CScript& scriptPubKey, const C } // Additional validation for spend-to-script-hash transactions: - if ((flags & SCRIPT_VERIFY_P2SH) && scriptPubKey.IsPayToScriptHash()) + if ((flags & SCRIPT_VERIFY_P2SH) && scriptPubKey.IsPayToScriptHash(true)) { // scriptSig must be literals-only or validation fails if (!scriptSig.IsPushOnly()) @@ -1567,7 +1567,7 @@ size_t CountWitnessSigOps(const CScript& scriptSig, const CScript& scriptPubKey, return WitnessSigOps(witnessversion, witnessprogram, witness ? *witness : witnessEmpty, flags); } - if (scriptPubKey.IsPayToScriptHash() && scriptSig.IsPushOnly()) { + if (scriptPubKey.IsPayToScriptHash(true) && scriptSig.IsPushOnly()) { CScript::const_iterator pc = scriptSig.begin(); std::vector data; while (pc < scriptSig.end()) { diff --git a/src/script/script.cpp b/src/script/script.cpp index 65e5405eb..b4457f88a 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -5,6 +5,7 @@ #include