Skip to content

Commit

Permalink
Reduce mnw logs / add mnw misbehave for specific conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Aug 28, 2015
1 parent 4fb859f commit 5cc8c79
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 5cc8c79

Please sign in to comment.