Reduce mnw logs / add mnw misbehave for specific conditions

This commit is contained in:
Evan Duffield 2015-08-28 08:53:08 -07:00
parent 4fb859f3c8
commit 5cc8c79c7c

View File

@ -383,7 +383,7 @@ void CMasternodePayments::ProcessMessageMasternodePayments(CNode* pfrom, std::st
std::string strError = "";
if(!winner.IsValid(pfrom, strError)){
LogPrintf("mnw - invalid message - %s\n", strError);
if(strError != "") LogPrintf("mnw - invalid message - %s\n", strError);
return;
}
@ -649,9 +649,15 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError)
int n = mnodeman.GetMasternodeRank(vinMasternode, nBlockHeight-100, MIN_MNW_PEER_PROTO_VERSION);
if(n > MNPAYMENTS_SIGNATURES_TOTAL)
{
strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, n);
LogPrintf("CMasternodePaymentWinner::IsValid - %s\n", strError);
{
//It's common to have masternodes mistakenly think they are in the top 10
// We don't want to print all of these messages, or punish them unless they're way off
if(n > MNPAYMENTS_SIGNATURES_TOTAL*2)
{
strError = strprintf("Masternode not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, n);
LogPrintf("CMasternodePaymentWinner::IsValid - %s\n", strError);
Misbehaving(pnode->GetId(), 20);
}
return false;
}