//
// verifyFlags is a comma separated list of script verification flags to apply, or "NONE"
UniValue tests = read_json(std::string(json_tests::tx_valid, json_tests::tx_valid + sizeof(json_tests::tx_valid)));
+ std::string comment("");
auto verifier = libzcash::ProofVerifier::Strict();
ScriptError err;
{
if (test.size() != 3 || !test[1].isStr() || !test[2].isStr())
{
- BOOST_ERROR("Bad test: " << strTest);
+ BOOST_ERROR("Bad test: " << strTest << comment);
continue;
}
}
if (!fValid)
{
- BOOST_ERROR("Bad test: " << strTest);
+ BOOST_ERROR("Bad test: " << strTest << comment);
continue;
}
stream >> tx;
CValidationState state;
- BOOST_CHECK_MESSAGE(CheckTransaction(tx, state, verifier), strTest);
- BOOST_CHECK(state.IsValid());
+ BOOST_CHECK_MESSAGE(CheckTransaction(tx, state, verifier), strTest + comment);
+ BOOST_CHECK_MESSAGE(state.IsValid(), comment);
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
if (!mapprevOutScriptPubKeys.count(tx.vin[i].prevout))
{
- BOOST_ERROR("Bad test: " << strTest);
+ BOOST_ERROR("Bad test: " << strTest << comment);
break;
}
unsigned int verify_flags = ParseScriptFlags(test[2].get_str());
BOOST_CHECK_MESSAGE(VerifyScript(tx.vin[i].scriptSig, mapprevOutScriptPubKeys[tx.vin[i].prevout],
verify_flags, TransactionSignatureChecker(&tx, i), &err),
- strTest);
- BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
+ strTest + comment);
+ BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err) + comment);
}
+
+ comment = "";
+ }
+ else if (test.size() == 1)
+ {
+ comment += "\n# ";
+ comment += test[0].write();
}
}
}
//
// 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)));
+ std::string comment("");
auto verifier = libzcash::ProofVerifier::Strict();
ScriptError err;
{
if (test.size() != 3 || !test[1].isStr() || !test[2].isStr())
{
- BOOST_ERROR("Bad test: " << strTest);
+ BOOST_ERROR("Bad test: " << strTest << comment);
continue;
}
}
if (!fValid)
{
- BOOST_ERROR("Bad test: " << strTest);
+ BOOST_ERROR("Bad test: " << strTest << comment);
continue;
}
{
if (!mapprevOutScriptPubKeys.count(tx.vin[i].prevout))
{
- BOOST_ERROR("Bad test: " << strTest);
+ BOOST_ERROR("Bad test: " << strTest << comment);
break;
}
fValid = VerifyScript(tx.vin[i].scriptSig, mapprevOutScriptPubKeys[tx.vin[i].prevout],
verify_flags, TransactionSignatureChecker(&tx, i), &err);
}
- BOOST_CHECK_MESSAGE(!fValid, strTest);
- BOOST_CHECK_MESSAGE(err != SCRIPT_ERR_OK, ScriptErrorString(err));
+ BOOST_CHECK_MESSAGE(!fValid, strTest + comment);
+ BOOST_CHECK_MESSAGE(err != SCRIPT_ERR_OK, ScriptErrorString(err) + comment);
+
+ comment = "";
+ }
+ else if (test.size() == 1)
+ {
+ comment += "\n# ";
+ comment += test[0].write();
}
}
}