Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 516 Lines • ▼ Show 20 Lines | // TODO: add tests for remaining script flags | ||||
* caching. | * caching. | ||||
*/ | */ | ||||
CheckInputsLimiter sigchecklimiter6(1); | CheckInputsLimiter sigchecklimiter6(1); | ||||
CValidationState state6; | CValidationState state6; | ||||
BOOST_CHECK(!CheckInputs(transaction, state6, pcoinsTip.get(), true, | BOOST_CHECK(!CheckInputs(transaction, state6, pcoinsTip.get(), true, | ||||
flags, true, true, txdata, nSigChecksDummy, | flags, true, true, txdata, nSigChecksDummy, | ||||
nullptr, &sigchecklimiter6)); | nullptr, &sigchecklimiter6)); | ||||
BOOST_CHECK_EQUAL(state6.GetRejectReason(), "too-many-sigchecks"); | BOOST_CHECK_EQUAL(state6.GetRejectReason(), "too-many-sigchecks"); | ||||
BOOST_CHECK_EQUAL(state6.GetDoS(), 100); | |||||
BOOST_CHECK_EQUAL(state6.GetRejectCode(), REJECT_INVALID); | |||||
BOOST_CHECK(!sigchecklimiter6.check()); | BOOST_CHECK(!sigchecklimiter6.check()); | ||||
// even in parallel validation, immediate fail from the cache. | // even in parallel validation, immediate fail from the cache. | ||||
std::vector<CScriptCheck> scriptchecks7; | std::vector<CScriptCheck> scriptchecks7; | ||||
CheckInputsLimiter sigchecklimiter7(1); | CheckInputsLimiter sigchecklimiter7(1); | ||||
CValidationState state7; | CValidationState state7; | ||||
BOOST_CHECK(!CheckInputs(transaction, state7, pcoinsTip.get(), true, | BOOST_CHECK(!CheckInputs(transaction, state7, pcoinsTip.get(), true, | ||||
flags, true, true, txdata, nSigChecksDummy, | flags, true, true, txdata, nSigChecksDummy, | ||||
&scriptchecks7, &sigchecklimiter7)); | &scriptchecks7, &sigchecklimiter7)); | ||||
BOOST_CHECK_EQUAL(state7.GetRejectReason(), "too-many-sigchecks"); | BOOST_CHECK_EQUAL(state7.GetRejectReason(), "too-many-sigchecks"); | ||||
BOOST_CHECK_EQUAL(state7.GetDoS(), 100); | |||||
BOOST_CHECK_EQUAL(state7.GetRejectCode(), REJECT_INVALID); | |||||
BOOST_CHECK(!sigchecklimiter7.check()); | BOOST_CHECK(!sigchecklimiter7.check()); | ||||
BOOST_CHECK(scriptchecks7.empty()); | BOOST_CHECK(scriptchecks7.empty()); | ||||
} | } | ||||
// Check that if the second input is invalid, but the first input is | // Check that if the second input is invalid, but the first input is | ||||
// valid, the transaction is not cached. | // valid, the transaction is not cached. | ||||
// Invalidate vin[1] | // Invalidate vin[1] | ||||
tx.vin[1].scriptSig = CScript(); | tx.vin[1].scriptSig = CScript(); | ||||
▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines |