Use MoneyRange(txout.nValue) to get rid of excessive checking.
[novacoin.git] / src / main.cpp
index 2a9eb29..7cce81e 100644 (file)
@@ -498,11 +498,8 @@ bool CTransaction::CheckTransaction() const
         const CTxOut& txout = vout[i];
         if (txout.IsEmpty() && !IsCoinBase() && !IsCoinStake())
             return DoS(100, error("CTransaction::CheckTransaction() : txout empty for user transaction"));
-
-        if (txout.nValue < 0)
-            return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue is negative"));
-        if (txout.nValue > MAX_MONEY)
-            return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue too high"));
+        if (!MoneyRange(txout.nValue))
+            return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue is out of range"));
         nValueOut += txout.nValue;
         if (!MoneyRange(nValueOut))
             return DoS(100, error("CTransaction::CheckTransaction() : txout total out of range"));