From 47d09ac2db5aebf2a8fdf2c551569fc03449cea0 Mon Sep 17 00:00:00 2001 From: Tim Flynn Date: Wed, 16 Nov 2016 10:37:40 -0500 Subject: [PATCH] Exit if cache files can't be read --- src/init.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index c3c37fd4f8..a2dbd8bb57 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1860,19 +1860,27 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) uiInterface.InitMessage(_("Loading masternode cache...")); CFlatDB flatdb1("mncache.dat", "magicMasternodeCache"); - flatdb1.Load(mnodeman); + if(!flatdb1.Load(mnodeman)) { + return InitError("Failed to load masternode cache from mncache.dat"); + } uiInterface.InitMessage(_("Loading masternode payment cache...")); CFlatDB flatdb2("mnpayments.dat", "magicMasternodePaymentsCache"); - flatdb2.Load(mnpayments); + if(!flatdb2.Load(mnpayments)) { + return InitError("Failed to load masternode payments cache from mnpayments.dat"); + } CFlatDB flatdb3("governance.dat", "magicGovernanceCache"); - flatdb3.Load(governance); + if(!flatdb3.Load(governance)) { + return InitError("Failed to load governance cache from governance.dat"); + } governance.ClearSeen(); uiInterface.InitMessage(_("Loading fullfiled requests cache...")); CFlatDB flatdb4("netfulfilled.dat", "magicFulfilledCache"); - flatdb4.Load(netfulfilledman); + if(!flatdb4.Load(netfulfilledman)) { + return InitError("Failed to load fulfilled requests cache from netfulfilled.dat"); + } // ********************************************************* Step 11c: update block tip in Dash modules