Don't increase PoSe ban score when can't connect (#1197)

This commit is contained in:
UdjinM6 2016-12-11 10:18:52 +04:00 committed by GitHub
parent df5abf1468
commit e9125835b7
2 changed files with 11 additions and 21 deletions

View File

@ -1558,7 +1558,6 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
} else { } else {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect, addr=%s\n", pmn->addr.ToString()); LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect, addr=%s\n", pmn->addr.ToString());
strAutoDenomResult = _("Error connecting to Masternode."); strAutoDenomResult = _("Error connecting to Masternode.");
pmn->IncreasePoSeBanScore();
continue; continue;
} }
} }
@ -1611,7 +1610,6 @@ bool CDarksendPool::DoAutomaticDenominating(bool fDryRun)
} else { } else {
LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect, addr=%s\n", pmn->addr.ToString()); LogPrintf("CDarksendPool::DoAutomaticDenominating -- can't connect, addr=%s\n", pmn->addr.ToString());
nTries++; nTries++;
pmn->IncreasePoSeBanScore();
continue; continue;
} }
} }

View File

@ -969,27 +969,19 @@ bool CMasternodeMan::SendVerifyRequest(const CAddress& addr, const std::vector<C
} }
CNode* pnode = ConnectNode(addr, NULL, true); CNode* pnode = ConnectNode(addr, NULL, true);
if(pnode != NULL) { if(pnode == NULL) {
netfulfilledman.AddFulfilledRequest(addr, strprintf("%s", NetMsgType::MNVERIFY)+"-request"); LogPrintf("CMasternodeMan::SendVerifyRequest -- can't connect to node to verify it, addr=%s\n", addr.ToString());
// use random nonce, store it and require node to reply with correct one later
CMasternodeVerification mnv(addr, GetRandInt(999999), pCurrentBlockIndex->nHeight - 1);
mWeAskedForVerification[addr] = mnv;
LogPrintf("CMasternodeMan::SendVerifyRequest -- verifying using nonce %d addr=%s\n", mnv.nonce, addr.ToString());
pnode->PushMessage(NetMsgType::MNVERIFY, mnv);
return true;
} else {
// can't connect, add some PoSe "ban score" to all masternodes with given addr
bool fFound = false;
BOOST_FOREACH(CMasternode* pmn, vSortedByAddr) {
if(pmn->addr != addr) {
if(fFound) break;
continue;
}
fFound = true;
pmn->IncreasePoSeBanScore();
}
return false; return false;
} }
netfulfilledman.AddFulfilledRequest(addr, strprintf("%s", NetMsgType::MNVERIFY)+"-request");
// use random nonce, store it and require node to reply with correct one later
CMasternodeVerification mnv(addr, GetRandInt(999999), pCurrentBlockIndex->nHeight - 1);
mWeAskedForVerification[addr] = mnv;
LogPrintf("CMasternodeMan::SendVerifyRequest -- verifying node using nonce %d addr=%s\n", mnv.nonce, addr.ToString());
pnode->PushMessage(NetMsgType::MNVERIFY, mnv);
return true;
} }
void CMasternodeMan::SendVerifyReply(CNode* pnode, CMasternodeVerification& mnv) void CMasternodeMan::SendVerifyReply(CNode* pnode, CMasternodeVerification& mnv)