fix sync reset which is triggered erroneously during reindex (#1478)
This commit is contained in:
parent
27f3218de9
commit
62963e9111
@ -49,18 +49,19 @@ bool CMasternodeSync::CheckNodeHeight(CNode* pnode, bool fDisconnectStuckNodes)
|
|||||||
bool CMasternodeSync::IsBlockchainSynced(bool fBlockAccepted)
|
bool CMasternodeSync::IsBlockchainSynced(bool fBlockAccepted)
|
||||||
{
|
{
|
||||||
static bool fBlockchainSynced = false;
|
static bool fBlockchainSynced = false;
|
||||||
static int64_t nTimeLastProcess = GetTime();
|
|
||||||
static int nSkipped = 0;
|
static int nSkipped = 0;
|
||||||
static bool fFirstBlockAccepted = false;
|
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 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) {
|
if(GetTime() - nTimeLastProcess > 60*60) {
|
||||||
Reset();
|
Reset();
|
||||||
fBlockchainSynced = false;
|
fBlockchainSynced = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pCurrentBlockIndex || !pindexBestHeader || fImporting || fReindex) return false;
|
|
||||||
|
|
||||||
if(fBlockAccepted) {
|
if(fBlockAccepted) {
|
||||||
// this should be only triggered while we are still syncing
|
// this should be only triggered while we are still syncing
|
||||||
if(!IsSynced()) {
|
if(!IsSynced()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user