X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.cpp;h=bdc7e8d6d3e55029aba4a490d78b86ca25986a39;hb=15e9a03687e99d6b1a7a90e56e69a37faa6bb9b8;hp=970dd7e8d705eb6a22c9d831a08c790ec6a9e16f;hpb=3bdc0abd5d7e262151c62426cb3006433fb21ffc;p=novacoin.git diff --git a/src/main.cpp b/src/main.cpp index 970dd7e..bdc7e8d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -181,10 +181,10 @@ void static Inventory(const uint256& hash) } // ask wallets to resend their transactions -void ResendWalletTransactions() +void ResendWalletTransactions(bool fForceResend) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) - pwallet->ResendWalletTransactions(); + pwallet->ResendWalletTransactions(fForceResend); } @@ -510,10 +510,6 @@ bool CTransaction::CheckTransaction() const return DoS(10, error("CTransaction::CheckTransaction() : vin empty")); if (vout.empty()) return DoS(10, error("CTransaction::CheckTransaction() : vout empty")); - // Time (prevent mempool memory exhaustion attack) - // Comes into force since 20 December 2015. - if (nTime > 1450569600 && nTime > FutureDrift(GetAdjustedTime())) - return DoS(10, error("CTransaction::CheckTransaction() : timestamp is too far into the future")); // Size limits if (::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) return DoS(100, error("CTransaction::CheckTransaction() : size limits failed")); @@ -622,6 +618,10 @@ bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs, if (pfMissingInputs) *pfMissingInputs = false; + // Time (prevent mempool memory exhaustion attack) + if (tx.nTime > FutureDrift(GetAdjustedTime())) + return tx.DoS(10, error("CTxMemPool::accept() : transaction timestamp is too far in the future")); + if (!tx.CheckTransaction()) return error("CTxMemPool::accept() : CheckTransaction failed"); @@ -2348,8 +2348,8 @@ bool CBlock::AcceptBlock() int64_t nMedianTimePast = pindexPrev->GetMedianTimePast(); int nMaxOffset = 12 * nOneHour; // 12 hours - if (pindexPrev->nTime < 1450569600) - nMaxOffset = nOneWeek; // One week until 20 Dec, 2015 + if (fTestNet || pindexPrev->nTime < 1450569600) + nMaxOffset = 7 * nOneWeek; // One week (permanently on testNet or until 20 Dec, 2015 on mainNet) // Check timestamp against prev if (GetBlockTime() <= nMedianTimePast || FutureDrift(GetBlockTime()) < pindexPrev->GetBlockTime())