| 148 | } |
| 149 | |
| 150 | void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, int flags, const std::string& message, int scriptError, CAmount nValue) |
| 151 | { |
| 152 | bool expect = (scriptError == SCRIPT_ERR_OK); |
| 153 | ScriptError err; |
| 154 | CMutableTransaction txCredit = BuildCreditingTransaction(scriptPubKey, nValue); |
| 155 | CMutableTransaction tx = BuildSpendingTransaction(scriptSig, txCredit); |
| 156 | CMutableTransaction tx2 = tx; |
| 157 | BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, flags, MutableTransactionSignatureChecker(&tx, 0, txCredit.vout[0].nValue), &err) == expect, message); |
| 158 | BOOST_CHECK_MESSAGE(err == scriptError, std::string(FormatScriptError(err)) + " where " + std::string(FormatScriptError((ScriptError_t)scriptError)) + " expected: " + message); |
| 159 | #if defined(HAVE_CONSENSUS_LIB) |
| 160 | CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); |
| 161 | stream << tx2; |
| 162 | if (nValue == 0) { |
| 163 | BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(begin_ptr(scriptPubKey), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, flags, NULL) == expect,message); |
| 164 | } |
| 165 | #endif |
| 166 | } |
| 167 | |
| 168 | void static NegateSignatureS(std::vector<unsigned char>& vchSig) { |
| 169 | // Parse the signature. |
no test coverage detected