Ignore payments and governance cache when mncache is empty (#1227)

This commit is contained in:
UdjinM6 2016-12-26 19:33:28 +04:00 committed by GitHub
parent cda28d3c72
commit 32d5f4b013

View File

@ -1874,18 +1874,22 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError("Failed to load masternode cache from mncache.dat"); return InitError("Failed to load masternode cache from mncache.dat");
} }
uiInterface.InitMessage(_("Loading masternode payment cache...")); if(mnodeman.size()) {
CFlatDB<CMasternodePayments> flatdb2("mnpayments.dat", "magicMasternodePaymentsCache"); uiInterface.InitMessage(_("Loading masternode payment cache..."));
if(!flatdb2.Load(mnpayments)) { CFlatDB<CMasternodePayments> flatdb2("mnpayments.dat", "magicMasternodePaymentsCache");
return InitError("Failed to load masternode payments cache from mnpayments.dat"); if(!flatdb2.Load(mnpayments)) {
} return InitError("Failed to load masternode payments cache from mnpayments.dat");
}
uiInterface.InitMessage(_("Loading governance cache...")); uiInterface.InitMessage(_("Loading governance cache..."));
CFlatDB<CGovernanceManager> flatdb3("governance.dat", "magicGovernanceCache"); CFlatDB<CGovernanceManager> flatdb3("governance.dat", "magicGovernanceCache");
if(!flatdb3.Load(governance)) { if(!flatdb3.Load(governance)) {
return InitError("Failed to load governance cache from governance.dat"); return InitError("Failed to load governance cache from governance.dat");
}
governance.InitOnLoad();
} else {
uiInterface.InitMessage(_("Masternode cache is empty, skipping payments and governance cache..."));
} }
governance.InitOnLoad();
uiInterface.InitMessage(_("Loading fullfiled requests cache...")); uiInterface.InitMessage(_("Loading fullfiled requests cache..."));
CFlatDB<CNetFulfilledRequestManager> flatdb4("netfulfilled.dat", "magicFulfilledCache"); CFlatDB<CNetFulfilledRequestManager> flatdb4("netfulfilled.dat", "magicFulfilledCache");