aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2013-07-10 08:50:49 -0700
committerJeff Garzik <jgarzik@bitpay.com>2013-07-10 08:50:49 -0700
commitd598872726ce9e2cbabdf705a616495c44851c2c (patch)
tree13343dce5db62d7a633799a732849ef23d4642e7 /src/test
parent3b837d5679af0c54ef2cef233cf42c09cdc50926 (diff)
parent980bfe6ef8bf03633d98f4d51e925c1aa4349421 (diff)
downloadbitcoin-d598872726ce9e2cbabdf705a616495c44851c2c.tar.xz
Merge pull request #2743 from jgarzik/reject-reason
Log reason for non-standard transaction rejection
Diffstat (limited to 'src/test')
-rw-r--r--src/test/script_P2SH_tests.cpp8
-rw-r--r--src/test/transaction_tests.cpp9
2 files changed, 10 insertions, 7 deletions
diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp
index 23cb3a8e0a..3c666d2842 100644
--- a/src/test/script_P2SH_tests.cpp
+++ b/src/test/script_P2SH_tests.cpp
@@ -74,6 +74,7 @@ BOOST_AUTO_TEST_CASE(sign)
}
CTransaction txFrom; // Funding transaction:
+ string reason;
txFrom.vout.resize(8);
for (int i = 0; i < 4; i++)
{
@@ -82,7 +83,7 @@ BOOST_AUTO_TEST_CASE(sign)
txFrom.vout[i+4].scriptPubKey = standardScripts[i];
txFrom.vout[i+4].nValue = COIN;
}
- BOOST_CHECK(IsStandardTx(txFrom));
+ BOOST_CHECK(IsStandardTx(txFrom, reason));
CTransaction txTo[8]; // Spending transactions
for (int i = 0; i < 8; i++)
@@ -167,13 +168,14 @@ BOOST_AUTO_TEST_CASE(set)
}
CTransaction txFrom; // Funding transaction:
+ string reason;
txFrom.vout.resize(4);
for (int i = 0; i < 4; i++)
{
txFrom.vout[i].scriptPubKey = outer[i];
txFrom.vout[i].nValue = CENT;
}
- BOOST_CHECK(IsStandardTx(txFrom));
+ BOOST_CHECK(IsStandardTx(txFrom, reason));
CTransaction txTo[4]; // Spending transactions
for (int i = 0; i < 4; i++)
@@ -189,7 +191,7 @@ BOOST_AUTO_TEST_CASE(set)
for (int i = 0; i < 4; i++)
{
BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i));
- BOOST_CHECK_MESSAGE(IsStandardTx(txTo[i]), strprintf("txTo[%d].IsStandard", i));
+ BOOST_CHECK_MESSAGE(IsStandardTx(txTo[i], reason), strprintf("txTo[%d].IsStandard", i));
}
}
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 53d1307b69..0c7475b4f2 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -260,16 +260,17 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
key.MakeNewKey(true);
t.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID());
- BOOST_CHECK(IsStandardTx(t));
+ string reason;
+ BOOST_CHECK(IsStandardTx(t, reason));
t.vout[0].nValue = 5011; // dust
- BOOST_CHECK(!IsStandardTx(t));
+ BOOST_CHECK(!IsStandardTx(t, reason));
t.vout[0].nValue = 6011; // not dust
- BOOST_CHECK(IsStandardTx(t));
+ BOOST_CHECK(IsStandardTx(t, reason));
t.vout[0].scriptPubKey = CScript() << OP_1;
- BOOST_CHECK(!IsStandardTx(t));
+ BOOST_CHECK(!IsStandardTx(t, reason));
}
BOOST_AUTO_TEST_SUITE_END()