Mercurial > hg > bitcoin
changeset 3469:ace9c669e3a7 draft
check tx.CheckTransaction for data-driven tx tests.
(and change so that only one case has to fail to make a tx_invalid
test correct)
author | Matt Corallo <git@bluematt.me> |
---|---|
date | Wed, 05 Sep 2012 21:46:48 -0400 |
parents | 233fa9b8fcbe |
children | c746a81832a0 |
files | src/test/transaction_tests.cpp |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -66,6 +66,8 @@ CTransaction tx; stream >> tx; + BOOST_CHECK_MESSAGE(tx.CheckTransaction(), strTest); + for (unsigned int i = 0; i < tx.vin.size(); i++) { if (!mapprevOutScriptPubKeys.count(tx.vin[i].prevout)) @@ -131,7 +133,9 @@ CTransaction tx; stream >> tx; - for (unsigned int i = 0; i < tx.vin.size(); i++) + fValid = tx.CheckTransaction(); + + for (unsigned int i = 0; i < tx.vin.size() && fValid; i++) { if (!mapprevOutScriptPubKeys.count(tx.vin[i].prevout)) { @@ -139,8 +143,10 @@ break; } - BOOST_CHECK_MESSAGE(!VerifyScript(tx.vin[i].scriptSig, mapprevOutScriptPubKeys[tx.vin[i].prevout], tx, i, test[2].get_bool(), 0), strTest); + fValid = VerifyScript(tx.vin[i].scriptSig, mapprevOutScriptPubKeys[tx.vin[i].prevout], tx, i, test[2].get_bool(), 0); } + + BOOST_CHECK_MESSAGE(!fValid, strTest); } } }