fix sync reset which is triggered erroneously during reindex (#1478)

This commit is contained in:
UdjinM6 2017-05-31 06:48:47 +03:00 committed by GitHub
parent 27f3218de9
commit 62963e9111

View File

@ -49,18 +49,19 @@ bool CMasternodeSync::CheckNodeHeight(CNode* pnode, bool fDisconnectStuckNodes)
bool CMasternodeSync::IsBlockchainSynced(bool fBlockAccepted)
{
static bool fBlockchainSynced = false;
static int64_t nTimeLastProcess = GetTime();
static int nSkipped = 0;
static bool fFirstBlockAccepted = false;
if(!pCurrentBlockIndex || !pindexBestHeader || fImporting || fReindex) return false;
static int64_t nTimeLastProcess = GetTime();
// if the last call to this function was more than 60 minutes ago (client was in sleep mode) reset the sync process
if(GetTime() - nTimeLastProcess > 60*60) {
Reset();
fBlockchainSynced = false;
}
if(!pCurrentBlockIndex || !pindexBestHeader || fImporting || fReindex) return false;
if(fBlockAccepted) {
// this should be only triggered while we are still syncing
if(!IsSynced()) {