Changeset View
Changeset View
Standalone View
Standalone View
src/test/txvalidationcache_tests.cpp
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
// evaluating any script flag that is implemented as an upgraded NOP code. | // evaluating any script flag that is implemented as an upgraded NOP code. | ||||
void ValidateCheckInputsForAllFlags(const CMutableTransaction &mutableTx, | void ValidateCheckInputsForAllFlags(const CMutableTransaction &mutableTx, | ||||
uint32_t failing_flags, bool add_to_cache, | uint32_t failing_flags, bool add_to_cache, | ||||
bool upgraded_nop) { | bool upgraded_nop) { | ||||
const CTransaction tx(mutableTx); | const CTransaction tx(mutableTx); | ||||
PrecomputedTransactionData txdata(tx); | PrecomputedTransactionData txdata(tx); | ||||
// If we add many more flags, this loop can get too expensive, but we can | // If we add many more flags, this loop can get too expensive, but we can | ||||
// rewrite in the future to randomly pick a set of flags to evaluate. | // rewrite in the future to randomly pick a set of flags to evaluate. | ||||
for (size_t test_flags = 0; test_flags < (1U << 17); test_flags += 1) { | for (uint32_t test_flags = 0; test_flags < (1U << 17); test_flags += 1) { | ||||
CValidationState state; | CValidationState state; | ||||
// Make sure the mandatory flags are enabled. | // Make sure the mandatory flags are enabled. | ||||
test_flags |= MANDATORY_SCRIPT_VERIFY_FLAGS; | test_flags |= MANDATORY_SCRIPT_VERIFY_FLAGS; | ||||
bool ret = CheckInputs(tx, state, pcoinsTip, true, test_flags, true, | bool ret = CheckInputs(tx, state, pcoinsTip, true, test_flags, true, | ||||
add_to_cache, txdata, nullptr); | add_to_cache, txdata, nullptr); | ||||
// CheckInputs should succeed iff test_flags doesn't intersect with | // CheckInputs should succeed iff test_flags doesn't intersect with | ||||
▲ Show 20 Lines • Show All 274 Lines • Show Last 20 Lines |