track asset sync time (#1479)

This commit is contained in:
UdjinM6 2017-05-31 06:49:09 +03:00 committed by GitHub
parent 62963e9111
commit fc406f2d82
3 changed files with 11 additions and 5 deletions

View File

@ -169,33 +169,37 @@ void CMasternodeSync::SwitchToNextAsset()
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
break; break;
case(MASTERNODE_SYNC_SPORKS): case(MASTERNODE_SYNC_SPORKS):
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %ss\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
nTimeLastMasternodeList = GetTime(); nTimeLastMasternodeList = GetTime();
nRequestedMasternodeAssets = MASTERNODE_SYNC_LIST; nRequestedMasternodeAssets = MASTERNODE_SYNC_LIST;
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
break; break;
case(MASTERNODE_SYNC_LIST): case(MASTERNODE_SYNC_LIST):
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %ss\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
nTimeLastPaymentVote = GetTime(); nTimeLastPaymentVote = GetTime();
nRequestedMasternodeAssets = MASTERNODE_SYNC_MNW; nRequestedMasternodeAssets = MASTERNODE_SYNC_MNW;
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
break; break;
case(MASTERNODE_SYNC_MNW): case(MASTERNODE_SYNC_MNW):
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %ss\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
nTimeLastGovernanceItem = GetTime(); nTimeLastGovernanceItem = GetTime();
nRequestedMasternodeAssets = MASTERNODE_SYNC_GOVERNANCE; nRequestedMasternodeAssets = MASTERNODE_SYNC_GOVERNANCE;
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName()); LogPrintf("CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
break; break;
case(MASTERNODE_SYNC_GOVERNANCE): case(MASTERNODE_SYNC_GOVERNANCE):
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Sync has finished\n"); LogPrintf("CMasternodeSync::SwitchToNextAsset -- Completed %s in %ss\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
nRequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED; nRequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED;
uiInterface.NotifyAdditionalDataSyncProgressChanged(1); uiInterface.NotifyAdditionalDataSyncProgressChanged(1);
//try to activate our masternode if possible //try to activate our masternode if possible
activeMasternode.ManageState(); activeMasternode.ManageState();
TRY_LOCK(cs_vNodes, lockRecv); TRY_LOCK(cs_vNodes, lockRecv);
if(!lockRecv) return; if(lockRecv) {
BOOST_FOREACH(CNode* pnode, vNodes) {
BOOST_FOREACH(CNode* pnode, vNodes) { netfulfilledman.AddFulfilledRequest(pnode->addr, "full-sync");
netfulfilledman.AddFulfilledRequest(pnode->addr, "full-sync"); }
} }
LogPrintf("CMasternodeSync::SwitchToNextAsset -- Sync has finished\n");
break; break;
} }

View File

@ -77,6 +77,7 @@ public:
int GetAssetID() { return nRequestedMasternodeAssets; } int GetAssetID() { return nRequestedMasternodeAssets; }
int GetAttempt() { return nRequestedMasternodeAttempt; } int GetAttempt() { return nRequestedMasternodeAttempt; }
int64_t GetAssetStartTime() { return nTimeAssetSyncStarted; }
std::string GetAssetName(); std::string GetAssetName();
std::string GetSyncStatus(); std::string GetSyncStatus();

View File

@ -153,6 +153,7 @@ UniValue mnsync(const UniValue& params, bool fHelp)
UniValue objStatus(UniValue::VOBJ); UniValue objStatus(UniValue::VOBJ);
objStatus.push_back(Pair("AssetID", masternodeSync.GetAssetID())); objStatus.push_back(Pair("AssetID", masternodeSync.GetAssetID()));
objStatus.push_back(Pair("AssetName", masternodeSync.GetAssetName())); objStatus.push_back(Pair("AssetName", masternodeSync.GetAssetName()));
objStatus.push_back(Pair("AssetStartTime", masternodeSync.GetAssetStartTime()));
objStatus.push_back(Pair("Attempt", masternodeSync.GetAttempt())); objStatus.push_back(Pair("Attempt", masternodeSync.GetAttempt()));
objStatus.push_back(Pair("IsBlockchainSynced", masternodeSync.IsBlockchainSynced())); objStatus.push_back(Pair("IsBlockchainSynced", masternodeSync.IsBlockchainSynced()));
objStatus.push_back(Pair("IsMasternodeListSynced", masternodeSync.IsMasternodeListSynced())); objStatus.push_back(Pair("IsMasternodeListSynced", masternodeSync.IsMasternodeListSynced()));