Changeset View
Changeset View
Standalone View
Standalone View
src/test/script_tests.cpp
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | static void DoTest(const CScript &scriptPubKey, const CScript &scriptSig, | ||||
// Verify that removing flags from a passing test or adding flags to a | // Verify that removing flags from a passing test or adding flags to a | ||||
// failing test does not change the result, except for some special flags. | // failing test does not change the result, except for some special flags. | ||||
for (int i = 0; i < 16; ++i) { | for (int i = 0; i < 16; ++i) { | ||||
uint32_t extra_flags = InsecureRandBits(32); | uint32_t extra_flags = InsecureRandBits(32); | ||||
// Some flags are not purely-restrictive and thus we can't assume | // Some flags are not purely-restrictive and thus we can't assume | ||||
// anything about what happens when they are flipped. Keep them as-is. | // anything about what happens when they are flipped. Keep them as-is. | ||||
extra_flags &= | extra_flags &= | ||||
~(SCRIPT_ENABLE_SIGHASH_FORKID | SCRIPT_ENABLE_REPLAY_PROTECTION | | ~(SCRIPT_ENABLE_SIGHASH_FORKID | SCRIPT_ENABLE_REPLAY_PROTECTION | | ||||
SCRIPT_ENABLE_SCHNORR_MULTISIG); | SCRIPT_ENABLE_SCHNORR_MULTISIG | SCRIPT_ENABLE_OP_REVERSEBYTES); | ||||
uint32_t combined_flags = | uint32_t combined_flags = | ||||
expect ? (flags & ~extra_flags) : (flags | extra_flags); | expect ? (flags & ~extra_flags) : (flags | extra_flags); | ||||
// Weed out invalid flag combinations. | // Weed out invalid flag combinations. | ||||
if (combined_flags & SCRIPT_VERIFY_CLEANSTACK) { | if (combined_flags & SCRIPT_VERIFY_CLEANSTACK) { | ||||
combined_flags |= SCRIPT_VERIFY_P2SH; | combined_flags |= SCRIPT_VERIFY_P2SH; | ||||
} | } | ||||
BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, | BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, | ||||
▲ Show 20 Lines • Show All 3,047 Lines • Show Last 20 Lines |