Merge pull request #427 from UdjinM6/v0.12.0.x_change_sync_activemn_start

V0.12.0.x Start all DS, mnodeman, IX related checks and activate mn only after sync is over
This commit is contained in:
evan82 2015-07-14 07:41:57 -07:00
commit eb9aa2cb87
2 changed files with 34 additions and 31 deletions

View File

@ -2333,27 +2333,6 @@ void ThreadCheckDarkSendPool()
MilliSleep(1000);
//LogPrintf("ThreadCheckDarkSendPool::check timeout\n");
darkSendPool.CheckTimeout();
darkSendPool.CheckForCompleteQueue();
if(c % 60 == 0)
{
LOCK(cs_main);
/*
cs_main is required for doing CMasternode.Check because something
is modifying the coins view without a mempool lock. It causes
segfaults from this code without the cs_main lock.
*/
mnodeman.CheckAndRemove();
mnodeman.ProcessMasternodeConnections();
masternodePayments.CleanPaymentList();
CleanTransactionLocksList();
}
if(c % MASTERNODE_PING_SECONDS == 0) activeMasternode.ManageStatus();
if(c % MASTERNODES_DUMP_SECONDS == 0) DumpMasternodes();
//try to sync the Masternode list and payment list every 5 seconds from at least 3 nodes
if(c % 5 == 0 && RequestedMasternodeAssets <= 5){
bool fIsInitialDownload = IsInitialBlockDownload();
@ -2401,8 +2380,27 @@ void ThreadCheckDarkSendPool()
}
}
}
} else if(c % 60 == 0 && RequestedMasternodeAssets == 3){
RequestedMasternodeAssets = MASTERNODE_LIST_SYNCED; //done syncing
} else if((c % 60 == 0 && RequestedMasternodeAssets >= 5 && RequestedMasternodeAssets < MASTERNODE_LIST_SYNCED) || //done syncing
(c % (5 * 60) == 0 && RequestedMasternodeAssets < 5)) { //couldn't find 5 peers in 5 minutes
RequestedMasternodeAssets = MASTERNODE_LIST_SYNCED;
c = 1; // reset counter
}
if(RequestedMasternodeAssets == MASTERNODE_LIST_SYNCED) {
if(c % MASTERNODE_PING_SECONDS == 1) activeMasternode.ManageStatus(); // activate right after sync
if(c % 60 == 0)
{
LOCK(cs_main);
/*
cs_main is required for doing CMasternode.Check because something
is modifying the coins view without a mempool lock. It causes
segfaults from this code without the cs_main lock.
*/
mnodeman.CheckAndRemove();
mnodeman.ProcessMasternodeConnections();
masternodePayments.CleanPaymentList();
CleanTransactionLocksList();
}
if(c % 60 == 0){
@ -2411,8 +2409,14 @@ void ThreadCheckDarkSendPool()
vecMasternodesUsed.clear();
}
if(c % MASTERNODES_DUMP_SECONDS == 0) DumpMasternodes();
darkSendPool.CheckTimeout();
darkSendPool.CheckForCompleteQueue();
if(darkSendPool.GetState() == POOL_STATUS_IDLE && c % 6 == 0){
darkSendPool.DoAutomaticDenominating();
}
}
}
}

View File

@ -1490,7 +1490,6 @@ bool AppInit2(boost::thread_group& threadGroup)
return InitError(_("You must specify a masternodeprivkey in the configuration. Please see documentation for help."));
}
if(Params().NetworkID() != CBaseChainParams::REGTEST) activeMasternode.ManageStatus();
}
if(GetBoolArg("-mnconflock", true)) {