Ensure sum of valueBalance and all vpub_new's does not exceed MAX_MONEY inside of CheckTransactionWithoutProofVerification.

This commit is contained in:
Sean Bowe
2018-07-30 22:35:31 -06:00
parent a11e6aaacc
commit 291895fac7
2 changed files with 65 additions and 1 deletions

View File

@@ -1223,8 +1223,18 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
REJECT_INVALID, "bad-txns-txintotal-toolarge");
}
}
}
// Also check for Sapling
if (tx.valueBalance >= 0) {
// NB: positive valueBalance "adds" money to the transparent value pool, just as inputs do
nValueIn += tx.valueBalance;
if (!MoneyRange(nValueIn)) {
return state.DoS(100, error("CheckTransaction(): txin total out of range"),
REJECT_INVALID, "bad-txns-txintotal-toolarge");
}
}
}
// Check for duplicate inputs
set<COutPoint> vInOutPoints;