Auto merge of #1341 - ebfull:fix-checktransaction-bug, r=ebfull

Fix CheckTransaction bugs.

Closes #1319.

Does not address the name of `vpub_old` or `vpub_new`.
This commit is contained in:
zkbot
2016-09-07 20:22:13 +00:00
3 changed files with 32 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_outputs) {
TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_joinsplit) {
CMutableTransaction mtx = GetValidTransaction();
mtx.vout[0].nValue = 1;
mtx.vjoinsplit[0].vpub_new = MAX_MONEY;
mtx.vjoinsplit[0].vpub_old = MAX_MONEY;
CTransaction tx(mtx);
@@ -180,6 +180,18 @@ TEST(checktransaction_tests, bad_txns_txouttotal_toolarge_joinsplit) {
CheckTransactionWithoutProofVerification(tx, state);
}
TEST(checktransaction_tests, bad_txns_txintotal_toolarge_joinsplit) {
CMutableTransaction mtx = GetValidTransaction();
mtx.vjoinsplit[0].vpub_new = MAX_MONEY - 1;
mtx.vjoinsplit[1].vpub_new = MAX_MONEY - 1;
CTransaction tx(mtx);
MockCValidationState state;
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-txintotal-toolarge", false)).Times(1);
CheckTransactionWithoutProofVerification(tx, state);
}
TEST(checktransaction_tests, bad_txns_vpub_old_negative) {
CMutableTransaction mtx = GetValidTransaction();
mtx.vjoinsplit[0].vpub_old = -1;