X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.cpp;h=3ab03f2686f2215a1c6f97474eac0a8d38bc9abb;hb=75744e6526193604bfbcc6be3a3793315556f12c;hp=dbd3276503a6b316d3cde0b4270261dfae2977d9;hpb=848b99c4b46b2905b0258d08f855857b3898a00f;p=novacoin.git diff --git a/src/main.cpp b/src/main.cpp index dbd3276..3ab03f2 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"); @@ -1762,7 +1762,8 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck) if (tx.nTime >= CHECKLOCKTIMEVERIFY_SWITCH_TIME) { nFlags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY; - nFlags |= SCRIPT_VERIFY_CHECKSEQUENCEVERIFY; + // OP_CHECKSEQUENCEVERIFY is senseless without BIP68, so we're going disable it for now. + // nFlags |= SCRIPT_VERIFY_CHECKSEQUENCEVERIFY; } std::vector vChecks; @@ -2346,9 +2347,9 @@ bool CBlock::AcceptBlock() return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake")); int64_t nMedianTimePast = pindexPrev->GetMedianTimePast(); - int nMaxOffset = 12 * 3600; // 12 hours - if (pindexPrev->nTime < 1450569600) - nMaxOffset = 7 * 86400; // One week until 20 Dec, 2015 + int nMaxOffset = 12 * nOneHour; // 12 hours + 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())