diff options
author | gzhao408 <gzhao408@berkeley.edu> | 2021-01-26 14:10:08 -0800 |
---|---|---|
committer | gzhao408 <gzhao408@berkeley.edu> | 2021-02-02 08:58:55 -0800 |
commit | 9532591bedaecf7c2debe779dec0a0debec2623b (patch) | |
tree | f0397dda64a341638641c771789f0d05f2e35326 /src/test/transaction_tests.cpp | |
parent | 4c06ebf1281f0f387ab7493fe15176a05247525e (diff) |
[test] add BADTX setting for invalid txns that fail CheckTransaction
Co-authored-by: Johnson Lau <jl2012@xbt.hk>
Diffstat (limited to 'src/test/transaction_tests.cpp')
-rw-r--r-- | src/test/transaction_tests.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 4d03e6cec1..44f183b17c 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -179,12 +179,6 @@ BOOST_AUTO_TEST_CASE(tx_valid) BOOST_AUTO_TEST_CASE(tx_invalid) { // Read tests from test/data/tx_invalid.json - // Format is an array of arrays - // Inner arrays are either [ "comment" ] - // or [[[prevout hash, prevout index, prevout scriptPubKey], [input 2], ...],"], serializedTransaction, verifyFlags - // ... where all scripts are stringified scripts. - // - // verifyFlags is a comma separated list of script verification flags to apply, or "NONE" UniValue tests = read_json(std::string(json_tests::tx_invalid, json_tests::tx_invalid + sizeof(json_tests::tx_invalid))); // Initialize to SCRIPT_ERR_OK. The tests expect err to be changed to a @@ -235,7 +229,10 @@ BOOST_AUTO_TEST_CASE(tx_invalid) CTransaction tx(deserialize, stream); TxValidationState state; - fValid = CheckTransaction(tx, state) && state.IsValid(); + if (!CheckTransaction(tx, state) || state.IsInvalid()) { + BOOST_CHECK_MESSAGE(test[2].get_str() == "BADTX", strTest); + continue; + } PrecomputedTransactionData txdata(tx); for (unsigned int i = 0; i < tx.vin.size() && fValid; i++) |