X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.cpp;h=befcfaacc130b8dbff67ba6c553aecc2de1fddc1;hb=76dd5491e364e8e7e4694a1a343101412450b419;hp=b8577398aea3068b3102d5e508b27665bb07d0ee;hpb=fe3160e5c4a0046b4f97ec6d32d280aaa6ecc74c;p=novacoin.git diff --git a/src/main.cpp b/src/main.cpp index b857739..befcfaa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,7 +7,6 @@ #include "checkpoints.h" #include "db.h" #include "txdb.h" -#include "net.h" #include "init.h" #include "ui_interface.h" #include "checkqueue.h" @@ -511,6 +510,10 @@ 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")); @@ -3668,7 +3671,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (!GetBoolArg("-allowreceivebyip")) { - pfrom->PushMessage("reply", hashReply, (int)2, string("")); + pfrom->PushMessage("reply", hashReply, 2, string("")); return true; } @@ -3684,7 +3687,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) // Send back approval of order and pubkey to use CScript scriptPubKey; scriptPubKey << mapReuseKey[pfrom->addr] << OP_CHECKSIG; - pfrom->PushMessage("reply", hashReply, (int)0, scriptPubKey); + pfrom->PushMessage("reply", hashReply, 0, scriptPubKey); } @@ -4084,4 +4087,4 @@ public: // orphan transactions } -} instance_of_cmaincleanup; \ No newline at end of file +} instance_of_cmaincleanup;