From f0790ed32ca22d878b166b3abf0d84b8ece1cbca Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 14 Aug 2015 04:14:08 +0300 Subject: [PATCH] fix dseep flood / log output --- src/activemasternode.cpp | 1 + src/masternode.cpp | 3 +++ src/masternode.h | 1 + src/masternodeman.cpp | 13 +++++++++++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/activemasternode.cpp b/src/activemasternode.cpp index f97b65eb2..ce9e0481b 100644 --- a/src/activemasternode.cpp +++ b/src/activemasternode.cpp @@ -200,6 +200,7 @@ bool CActiveMasternode::SendMasternodePing(std::string& errorMessage) { return false; } + LogPrint("masternode", "dseep - relaying from active mn, %s \n", vin.ToString().c_str()); LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) pnode->PushMessage("dseep", vin, vchMasterNodeSignature, masterNodeSignatureTime, false); diff --git a/src/masternode.cpp b/src/masternode.cpp index ddaa23d00..c1b1bb404 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -73,6 +73,7 @@ CMasternode::CMasternode() nScanningErrorCount = 0; nLastScanningErrorBlockHeight = 0; lastTimeChecked = 0; + nLastDseep = 0;// temporary, do not save. Remove after migration to v12 } CMasternode::CMasternode(const CMasternode& other) @@ -95,6 +96,7 @@ CMasternode::CMasternode(const CMasternode& other) nScanningErrorCount = other.nScanningErrorCount; nLastScanningErrorBlockHeight = other.nLastScanningErrorBlockHeight; lastTimeChecked = 0; + nLastDseep = other.nLastDseep;// temporary, do not save. Remove after migration to v12 } CMasternode::CMasternode(const CMasternodeBroadcast& mnb) @@ -117,6 +119,7 @@ CMasternode::CMasternode(const CMasternodeBroadcast& mnb) nScanningErrorCount = 0; nLastScanningErrorBlockHeight = 0; lastTimeChecked = 0; + nLastDseep = 0;// temporary, do not save. Remove after migration to v12 } // diff --git a/src/masternode.h b/src/masternode.h index 29848b737..2751b86bc 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -135,6 +135,7 @@ public: int nLastScanningErrorBlockHeight; CMasternodePing lastPing; + int64_t nLastDseep;// temporary, do not save. Remove after migration to v12 CMasternode(); CMasternode(const CMasternode& other); diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 501d20d9c..3be5cf1cc 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -1006,13 +1006,20 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData return; } + std::map::iterator i = mWeAskedForMasternodeListEntry.find(vin.prevout); + if (i != mWeAskedForMasternodeListEntry.end()) + { + int64_t t = (*i).second; + if (GetTime() < t) return; // we've asked recently + } + // see if we have this Masternode CMasternode* pmn = this->Find(vin); if(pmn != NULL && pmn->protocolVersion >= masternodePayments.GetMinMasternodePaymentsProto()) { // LogPrintf("dseep - Found corresponding mn for vin: %s\n", vin.ToString().c_str()); // take this only if it's newer - if(sigTime - pmn->lastPing.sigTime > MASTERNODE_MIN_MNP_SECONDS) + if(sigTime - pmn->nLastDseep > MASTERNODE_MIN_MNP_SECONDS) { std::string strMessage = pmn->addr.ToString() + boost::lexical_cast(sigTime) + boost::lexical_cast(stop); @@ -1026,10 +1033,12 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData // fake ping for v11 masternodes, ignore for v12 if(pmn->protocolVersion < GETHEADERS_VERSION) pmn->lastPing = CMasternodePing(vin); + pmn->nLastDseep = sigTime; pmn->Check(); if(pmn->IsEnabled()) { TRY_LOCK(cs_vNodes, lockNodes); if(!lockNodes) return; + LogPrint("masternode", "dseep - relaying %s \n", vin.ToString().c_str()); BOOST_FOREACH(CNode* pnode, vNodes) if(pnode->nVersion >= masternodePayments.GetMinMasternodePaymentsProto()) pnode->PushMessage("dseep", vin, vchSig, sigTime, stop); @@ -1038,7 +1047,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData return; } - LogPrint("masternode", "dseep - Couldn't find Masternode entry %s\n", vin.ToString().c_str()); + LogPrint("masternode", "dseep - Couldn't find Masternode entry %s %s\n", vin.ToString(), pfrom->addr.ToString()); AskForMN(pfrom, vin); }