Fix CheckTransaction bugs.

This commit is contained in:
Sean Bowe
2016-09-05 12:18:43 -06:00
parent b181f7032b
commit d7eeb7455b
2 changed files with 31 additions and 2 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;