From: CryptoManiac Date: Tue, 23 Feb 2016 20:07:39 +0000 (+0300) Subject: Move transaction timestamp checking to CTxMemPool::accept() X-Git-Tag: nvc-v0.5.6~42 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=8e852575f30e7632129a2d4285c1815ba8b4927f;hp=7a26953218f552a39094dce12c6941be4a847494 Move transaction timestamp checking to CTxMemPool::accept() --- diff --git a/src/main.cpp b/src/main.cpp index f3f1d55..54b852d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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");