[test] Check for invalid flag combinations

This commit is contained in:
gzhao408 2021-02-02 09:16:34 -08:00
parent a7098a2a8d
commit a260c22cad

View File

@ -222,6 +222,11 @@ BOOST_AUTO_TEST_CASE(tx_valid)
PrecomputedTransactionData txdata(tx); PrecomputedTransactionData txdata(tx);
unsigned int verify_flags = ParseScriptFlags(test[2].get_str()); unsigned int verify_flags = ParseScriptFlags(test[2].get_str());
// Check that the test gives a valid combination of flags (otherwise VerifyScript will throw). Don't edit the flags.
if (~verify_flags != FillFlags(~verify_flags)) {
BOOST_ERROR("Bad test flags: " << strTest);
}
if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, ~verify_flags, txdata, strTest, /* expect_valid */ true)) { if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, ~verify_flags, txdata, strTest, /* expect_valid */ true)) {
BOOST_ERROR("Tx unexpectedly failed: " << strTest); BOOST_ERROR("Tx unexpectedly failed: " << strTest);
} }