Skip to content

Commit

Permalink
Merge pull request #757 from UdjinM6/changeLogs
Browse files Browse the repository at this point in the history
Change logging for budgets a bit
  • Loading branch information
eduffield82 committed Apr 6, 2016
2 parents 431f729 + 4cd7689 commit c5d719c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/masternode-budget.cpp
Expand Up @@ -392,29 +392,35 @@ bool CBudgetManager::AddProposal(CBudgetProposal& budgetProposal)

void CBudgetManager::CheckAndRemove()
{
LogPrintf("CBudgetManager::CheckAndRemove \n");
LogPrintf("CBudgetManager::CheckAndRemove\n");

std::string strError = "";

LogPrintf("CBudgetManager::CheckAndRemove - mapFinalizedBudgets cleanup - size: %d\n", mapFinalizedBudgets.size());
std::map<uint256, CFinalizedBudget>::iterator it = mapFinalizedBudgets.begin();
while(it != mapFinalizedBudgets.end())
{
CFinalizedBudget* pfinalizedBudget = &((*it).second);

pfinalizedBudget->fValid = pfinalizedBudget->IsValid(strError);
LogPrintf("CBudgetManager::CheckAndRemove - pfinalizedBudget->IsValid - strError: %s\n", strError);
if(pfinalizedBudget->fValid) {
pfinalizedBudget->AutoCheck();
}

++it;
}

LogPrintf("CBudgetManager::CheckAndRemove - mapProposals cleanup - size: %d\n", mapProposals.size());
std::map<uint256, CBudgetProposal>::iterator it2 = mapProposals.begin();
while(it2 != mapProposals.end())
{
CBudgetProposal* pbudgetProposal = &((*it2).second);
pbudgetProposal->fValid = pbudgetProposal->IsValid(strError);
++it2;
}

LogPrintf("CBudgetManager::CheckAndRemove - PASSED\n");
}

void CBudgetManager::FillBlockPayee(CMutableTransaction& txNew, CAmount nFees)
Expand Down Expand Up @@ -804,6 +810,7 @@ void CBudgetManager::NewBlock()

//remove invalid votes once in a while (we have to check the signatures and validity of every vote, somewhat CPU intensive)

LogPrintf("CBudgetManager::NewBlock - askedForSourceProposalOrBudget cleanup - size: %d\n", askedForSourceProposalOrBudget.size());
std::map<uint256, int64_t>::iterator it = askedForSourceProposalOrBudget.begin();
while(it != askedForSourceProposalOrBudget.end()){
if((*it).second > GetTime() - (60*60*24)){
Expand All @@ -813,18 +820,21 @@ void CBudgetManager::NewBlock()
}
}

LogPrintf("CBudgetManager::NewBlock - mapProposals cleanup - size: %d\n", mapProposals.size());
std::map<uint256, CBudgetProposal>::iterator it2 = mapProposals.begin();
while(it2 != mapProposals.end()){
(*it2).second.CleanAndRemove(false);
++it2;
}

LogPrintf("CBudgetManager::NewBlock - mapFinalizedBudgets cleanup - size: %d\n", mapFinalizedBudgets.size());
std::map<uint256, CFinalizedBudget>::iterator it3 = mapFinalizedBudgets.begin();
while(it3 != mapFinalizedBudgets.end()){
(*it3).second.CleanAndRemove(false);
++it3;
}

LogPrintf("CBudgetManager::NewBlock - vecImmatureBudgetProposals cleanup - size: %d\n", vecImmatureBudgetProposals.size());
std::vector<CBudgetProposalBroadcast>::iterator it4 = vecImmatureBudgetProposals.begin();
while(it4 != vecImmatureBudgetProposals.end())
{
Expand All @@ -848,6 +858,7 @@ void CBudgetManager::NewBlock()
it4 = vecImmatureBudgetProposals.erase(it4);
}

LogPrintf("CBudgetManager::NewBlock - vecImmatureFinalizedBudgets cleanup - size: %d\n", vecImmatureFinalizedBudgets.size());
std::vector<CFinalizedBudgetBroadcast>::iterator it5 = vecImmatureFinalizedBudgets.begin();
while(it5 != vecImmatureFinalizedBudgets.end())
{
Expand All @@ -871,7 +882,7 @@ void CBudgetManager::NewBlock()

it5 = vecImmatureFinalizedBudgets.erase(it5);
}

LogPrintf("CBudgetManager::NewBlock - PASSED\n");
}

void CBudgetManager::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
Expand Down Expand Up @@ -1572,7 +1583,7 @@ bool CBudgetVote::SignatureValid(bool fSignatureCheck)

if(pmn == NULL)
{
LogPrintf("CBudgetVote::SignatureValid() - Unknown Masternode - %s\n", vin.ToString());
LogPrint("mnbudget", "CBudgetVote::SignatureValid() - Unknown Masternode - %s\n", vin.ToString());
return false;
}

Expand Down Expand Up @@ -1974,7 +1985,7 @@ bool CFinalizedBudgetVote::SignatureValid(bool fSignatureCheck)

if(pmn == NULL)
{
LogPrintf("CFinalizedBudgetVote::SignatureValid() - Unknown Masternode\n");
LogPrint("mnbudget", "CFinalizedBudgetVote::SignatureValid() - Unknown Masternode\n");
return false;
}

Expand Down

0 comments on commit c5d719c

Please sign in to comment.