enable cache files / remove old vote check

This commit is contained in:
Evan Duffield 2015-08-29 16:45:42 -07:00
parent c89f75d537
commit c407ae35dd
2 changed files with 51 additions and 71 deletions

View File

@ -169,9 +169,9 @@ void PrepareShutdown()
GenerateBitcoins(false, NULL, 0); GenerateBitcoins(false, NULL, 0);
#endif #endif
StopNode(); StopNode();
//DumpMasternodes(); DumpMasternodes();
//DumpBudgets(); DumpBudgets();
//DumpMasternodePayments(); DumpMasternodePayments();
UnregisterNodeSignals(GetNodeSignals()); UnregisterNodeSignals(GetNodeSignals());
if (fFeeEstimatesInitialized) if (fFeeEstimatesInitialized)
@ -1409,13 +1409,6 @@ bool AppInit2(boost::thread_group& threadGroup)
// ********************************************************* Step 10: setup DarkSend // ********************************************************* Step 10: setup DarkSend
/*
We sync all of this information on boot anyway, as it's kept on the network so there's really no point.
Also, it seems it might be causing some edge cases where clients can get stuck. I think it's better to just
sync from the network instead.
uiInterface.InitMessage(_("Loading masternode cache...")); uiInterface.InitMessage(_("Loading masternode cache..."));
CMasternodeDB mndb; CMasternodeDB mndb;
@ -1431,45 +1424,42 @@ bool AppInit2(boost::thread_group& threadGroup)
LogPrintf("file format is unknown or invalid, please fix it manually\n"); LogPrintf("file format is unknown or invalid, please fix it manually\n");
} }
uiInterface.InitMessage(_("Loading budget cache..."));
// --------- CBudgetDB budgetdb;
// uiInterface.InitMessage(_("Loading budget cache...")); CBudgetDB::ReadResult readResult2 = budgetdb.Read(budget);
// CBudgetDB budgetdb; if (readResult2 == CBudgetDB::FileError)
// CBudgetDB::ReadResult readResult2 = budgetdb.Read(budget); LogPrintf("Missing budget cache - budget.dat, will try to recreate\n");
else if (readResult2 != CBudgetDB::Ok)
{
LogPrintf("Error reading budget.dat: ");
if(readResult2 == CBudgetDB::IncorrectFormat)
LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
else
LogPrintf("file format is unknown or invalid, please fix it manually\n");
}
// if (readResult2 == CBudgetDB::FileError) //flag our cached items so we send them to our peers
// LogPrintf("Missing budget cache - budget.dat, will try to recreate\n"); budget.ResetSync();
// else if (readResult2 != CBudgetDB::Ok) budget.ClearSeen();
// {
// LogPrintf("Error reading budget.dat: ");
// if(readResult2 == CBudgetDB::IncorrectFormat)
// LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
// else
// LogPrintf("file format is unknown or invalid, please fix it manually\n");
// }
// //flag our cached items so we send them to our peers
// budget.ResetSync();
// budget.ClearSeen();
// uiInterface.InitMessage(_("Loading masternode payment cache...")); uiInterface.InitMessage(_("Loading masternode payment cache..."));
// CMasternodePaymentDB mnpayments; CMasternodePaymentDB mnpayments;
// CMasternodePaymentDB::ReadResult readResult3 = mnpayments.Read(masternodePayments); CMasternodePaymentDB::ReadResult readResult3 = mnpayments.Read(masternodePayments);
// if (readResult3 == CMasternodePaymentDB::FileError) if (readResult3 == CMasternodePaymentDB::FileError)
// LogPrintf("Missing masternode payment cache - mnpayments.dat, will try to recreate\n"); LogPrintf("Missing masternode payment cache - mnpayments.dat, will try to recreate\n");
// else if (readResult3 != CMasternodePaymentDB::Ok) else if (readResult3 != CMasternodePaymentDB::Ok)
// { {
// LogPrintf("Error reading mnpayments.dat: "); LogPrintf("Error reading mnpayments.dat: ");
// if(readResult3 == CMasternodePaymentDB::IncorrectFormat) if(readResult3 == CMasternodePaymentDB::IncorrectFormat)
// LogPrintf("magic is ok but data has invalid format, will try to recreate\n"); LogPrintf("magic is ok but data has invalid format, will try to recreate\n");
// else else
// LogPrintf("file format is unknown or invalid, please fix it manually\n"); LogPrintf("file format is unknown or invalid, please fix it manually\n");
// } }
*/
fMasterNode = GetBoolArg("-masternode", false); fMasterNode = GetBoolArg("-masternode", false);

View File

@ -1379,16 +1379,6 @@ bool CBudgetProposal::AddOrUpdateVote(CBudgetVote& vote, std::string& strError)
} }
} }
//if we're synced, the vote should have been recent
if(masternodeSync.IsSynced()) {
//up to an hour ago
if(vote.nTime < GetTime() - (60*60)){
strError = strprintf("new vote is too old - %s - nTime %lli - Min Time %lli\n", vote.GetHash().ToString(), vote.nTime, GetTime() - (60*60));
LogPrint("mnbudget", "CBudgetProposal::AddOrUpdateVote - %s\n", strError);
return false;
}
}
if(vote.nTime > GetTime() + (60*60)){ if(vote.nTime > GetTime() + (60*60)){
strError = strprintf("new vote is too far ahead of current time - %s - nTime %lli - Max Time %lli\n", vote.GetHash().ToString(), vote.nTime, GetTime() + (60*60)); strError = strprintf("new vote is too far ahead of current time - %s - nTime %lli - Max Time %lli\n", vote.GetHash().ToString(), vote.nTime, GetTime() + (60*60));
LogPrint("mnbudget", "CBudgetProposal::AddOrUpdateVote - %s\n", strError); LogPrint("mnbudget", "CBudgetProposal::AddOrUpdateVote - %s\n", strError);