Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 409 Lines • ▼ Show 20 Lines | // TODO: add tests for remaining script flags | ||||
tx.vin[1].scriptSig = CScript(); | tx.vin[1].scriptSig = CScript(); | ||||
CValidationState state; | CValidationState state; | ||||
CTransaction transaction(tx); | CTransaction transaction(tx); | ||||
PrecomputedTransactionData txdata(transaction); | PrecomputedTransactionData txdata(transaction); | ||||
// This transaction is now invalid because the second signature is | // This transaction is now invalid because the second signature is | ||||
// missing. | // missing. | ||||
BOOST_CHECK(!CheckInputs(transaction, state, pcoinsTip.get(), true, | BOOST_CHECK( | ||||
STANDARD_SCRIPT_VERIFY_FLAGS, true, true, | !CheckInputs(transaction, state, pcoinsTip.get(), true, | ||||
txdata, nullptr)); | STANDARD_SCRIPT_VERIFY_FLAGS | SCRIPT_REPORT_SIGCHECKS, | ||||
true, true, txdata, nullptr)); | |||||
// Make sure this transaction was not cached (ie becausethe first input | // Make sure this transaction was not cached (ie becausethe first input | ||||
// was valid) | // was valid) | ||||
std::vector<CScriptCheck> scriptchecks; | std::vector<CScriptCheck> scriptchecks; | ||||
BOOST_CHECK(CheckInputs(transaction, state, pcoinsTip.get(), true, | BOOST_CHECK( | ||||
STANDARD_SCRIPT_VERIFY_FLAGS, true, true, | CheckInputs(transaction, state, pcoinsTip.get(), true, | ||||
txdata, &scriptchecks)); | STANDARD_SCRIPT_VERIFY_FLAGS | SCRIPT_REPORT_SIGCHECKS, | ||||
true, true, txdata, &scriptchecks)); | |||||
// Should get 2 script checks back -- caching is on a whole-transaction | // Should get 2 script checks back -- caching is on a whole-transaction | ||||
// basis. | // basis. | ||||
BOOST_CHECK_EQUAL(scriptchecks.size(), 2U); | BOOST_CHECK_EQUAL(scriptchecks.size(), 2U); | ||||
// Execute the first check, and check its result | // Execute the first check, and check its result | ||||
BOOST_CHECK(scriptchecks[0]()); | BOOST_CHECK(scriptchecks[0]()); | ||||
BOOST_CHECK_EQUAL(scriptchecks[0].GetScriptError(), ScriptError::OK); | BOOST_CHECK_EQUAL(scriptchecks[0].GetScriptError(), ScriptError::OK); | ||||
BOOST_CHECK_EQUAL( | BOOST_CHECK_EQUAL( | ||||
Show All 9 Lines |