mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
slightly refactor
This commit is contained in:
parent
86c869137f
commit
4bcd548b62
@ -71,7 +71,12 @@ void CMasternodeSync::GetNextAsset()
|
|||||||
|
|
||||||
void CMasternodeSync::Process()
|
void CMasternodeSync::Process()
|
||||||
{
|
{
|
||||||
static int c = 0;
|
static int tick = 0;
|
||||||
|
|
||||||
|
if(tick++ % MASTERNODE_SYNC_TIMEOUT != 0) return;
|
||||||
|
|
||||||
|
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||||
|
if(pindexPrev == NULL) return;
|
||||||
|
|
||||||
if(IsSynced()) {
|
if(IsSynced()) {
|
||||||
/*
|
/*
|
||||||
@ -79,20 +84,14 @@ void CMasternodeSync::Process()
|
|||||||
*/
|
*/
|
||||||
if(mnodeman.CountEnabled() == 0) {
|
if(mnodeman.CountEnabled() == 0) {
|
||||||
RequestedMasternodeAssets = MASTERNODE_SYNC_INITIAL;
|
RequestedMasternodeAssets = MASTERNODE_SYNC_INITIAL;
|
||||||
GetNextAsset();
|
} else
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(c++ % MASTERNODE_SYNC_TIMEOUT != 0) return;
|
if(fDebug) LogPrintf("CMasternodeSync::Process() - tick %d RequestedMasternodeAssets %d\n", tick, RequestedMasternodeAssets);
|
||||||
|
|
||||||
if(fDebug) LogPrintf("CMasternodeSync::Process() - RequestedMasternodeAssets %d c %d\n", RequestedMasternodeAssets, c);
|
|
||||||
|
|
||||||
if(RequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL) GetNextAsset();
|
if(RequestedMasternodeAssets == MASTERNODE_SYNC_INITIAL) GetNextAsset();
|
||||||
|
|
||||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
|
||||||
if(pindexPrev == NULL) return;
|
|
||||||
|
|
||||||
LOCK(cs_vNodes);
|
LOCK(cs_vNodes);
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||||
{
|
{
|
||||||
@ -116,8 +115,8 @@ void CMasternodeSync::Process()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't begin syncing until we're at a recent block
|
//don't begin syncing until we're almost at a recent block
|
||||||
if(pindexPrev->nHeight < pindexBestHeader->nHeight) return;
|
if(pindexPrev->nHeight + 4 < pindexBestHeader->nHeight || pindexPrev->nTime + 600 < GetTime()) return;
|
||||||
|
|
||||||
if (pnode->nVersion >= nMasternodeMinProtocol) {
|
if (pnode->nVersion >= nMasternodeMinProtocol) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user