From: CryptoManiac Date: Sat, 7 May 2016 20:11:46 +0000 (+0300) Subject: Use MoneyRange(txout.nValue) to get rid of excessive checking. X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=641bbc230eb599a688a11d9c4260a6bcd629bb9f Use MoneyRange(txout.nValue) to get rid of excessive checking. --- diff --git a/novacoin-qt.pro b/novacoin-qt.pro index 5a9e09f..b453bfc 100644 --- a/novacoin-qt.pro +++ b/novacoin-qt.pro @@ -495,7 +495,7 @@ LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX # -lgdi32 has to happen after -lcrypto (see #681) windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32 -LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX +LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX -lz windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX -Wl,-Bstatic -lpthread -Wl,-Bdynamic contains(RELEASE, 1) { diff --git a/src/main.cpp b/src/main.cpp index 2a9eb29..7cce81e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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"));