cleanup CMasternodeSync a bit

This commit is contained in:
UdjinM6 2015-08-05 00:33:47 +03:00
parent 174f8a7644
commit 3f7e62e2bf

View File

@ -105,22 +105,9 @@ void CMasternodeSync::GetNextAsset()
switch(RequestedMasternodeAssets) switch(RequestedMasternodeAssets)
{ {
case(MASTERNODE_SYNC_INITIAL): case(MASTERNODE_SYNC_INITIAL):
case(MASTERNODE_SYNC_FAILED): case(MASTERNODE_SYNC_FAILED): // should never be used here actually, use Reset() instead
lastMasternodeList = 0;
lastMasternodeWinner = 0;
lastBudgetItem = 0;
lastFailure = 0;
nCountFailures = 0;
sumMasternodeList = 0;
sumMasternodeWinner = 0;
sumBudgetItemProp = 0;
sumBudgetItemFin = 0;
countMasternodeList = 0;
countMasternodeWinner = 0;
countBudgetItemProp = 0;
countBudgetItemFin = 0;
RequestedMasternodeAssets = MASTERNODE_SYNC_SPORKS;
ClearFulfilledRequest(); ClearFulfilledRequest();
RequestedMasternodeAssets = MASTERNODE_SYNC_SPORKS;
break; break;
case(MASTERNODE_SYNC_SPORKS): case(MASTERNODE_SYNC_SPORKS):
RequestedMasternodeAssets = MASTERNODE_SYNC_LIST; RequestedMasternodeAssets = MASTERNODE_SYNC_LIST;
@ -207,15 +194,14 @@ void CMasternodeSync::Process()
Resync if we lose all masternodes from sleep/wake or failure to sync originally Resync if we lose all masternodes from sleep/wake or failure to sync originally
*/ */
if(mnodeman.CountEnabled() == 0) { if(mnodeman.CountEnabled() == 0) {
ClearFulfilledRequest(); Reset();
RequestedMasternodeAssets = MASTERNODE_SYNC_INITIAL;
} else } else
return; return;
} }
//try syncing again in an hour //try syncing again in an hour
if(RequestedMasternodeAssets == MASTERNODE_SYNC_FAILED && lastFailure + (60*60) < GetTime()) { if(RequestedMasternodeAssets == MASTERNODE_SYNC_FAILED && lastFailure + (60*60) < GetTime()) {
GetNextAsset(); Reset();
} else if (RequestedMasternodeAssets == MASTERNODE_SYNC_FAILED) { } else if (RequestedMasternodeAssets == MASTERNODE_SYNC_FAILED) {
return; return;
} }