aboutsummaryrefslogtreecommitdiff
path: root/src/test/transaction_tests.cpp
diff options
context:
space:
mode:
authorgzhao408 <gzhao408@berkeley.edu>2021-02-02 09:16:34 -0800
committergzhao408 <gzhao408@berkeley.edu>2021-02-02 09:17:58 -0800
commita260c22cad0672dda11f42f649ebdc7cfa53b16a (patch)
treecf6043982f94c7a31cf07b240083fa9c44f3f51a /src/test/transaction_tests.cpp
parenta7098a2a8d2d23ee3be1d71ab8c71475bf5a31ee (diff)
downloadbitcoin-a260c22cad0672dda11f42f649ebdc7cfa53b16a.tar.xz
[test] Check for invalid flag combinations
Diffstat (limited to 'src/test/transaction_tests.cpp')
-rw-r--r--src/test/transaction_tests.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index b0d513939c..0102ec627f 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -222,6 +222,11 @@ BOOST_AUTO_TEST_CASE(tx_valid)
PrecomputedTransactionData txdata(tx);
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)) {
BOOST_ERROR("Tx unexpectedly failed: " << strTest);
}