Skip to content

Commit

Permalink
fix sync reset which is triggered erroneously during reindex (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 authored May 31, 2017
1 parent 27f3218 commit 62963e9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 62963e9

Please sign in to comment.