Skip to content

Commit ebbef96

Browse files
committed
masternodesync: connect the not-connected ProcessSyncStatusMsg.
Before, this function was being totally skipped for the tiertwo_networksync dispatcher function. The dispatcher internally processes `syncstatusaccount` messages and return true, which means that the message was processed, there by, it was never reaching the `masternodeSync.ProcessMessage` call in net_processing. Github-Pull: #2659 Rebased-From: ae28000
1 parent 281c061 commit ebbef96

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/masternode-sync.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,12 @@ std::string CMasternodeSync::GetSyncStatus()
220220
return "";
221221
}
222222

223-
void CMasternodeSync::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
223+
void CMasternodeSync::ProcessSyncStatusMsg(int nItemID, int nCount)
224224
{
225-
if (strCommand == NetMsgType::SYNCSTATUSCOUNT) { //Sync status count
226-
int nItemID;
227-
int nCount;
228-
vRecv >> nItemID >> nCount;
225+
if (RequestedMasternodeAssets >= MASTERNODE_SYNC_FINISHED) return;
229226

230-
if (RequestedMasternodeAssets >= MASTERNODE_SYNC_FINISHED) return;
231-
232-
//this means we will receive no further communication
233-
switch (nItemID) {
227+
//this means we will receive no further communication
228+
switch (nItemID) {
234229
case (MASTERNODE_SYNC_LIST):
235230
if (nItemID != RequestedMasternodeAssets) return;
236231
sumMasternodeList += nCount;
@@ -251,10 +246,11 @@ void CMasternodeSync::ProcessMessage(CNode* pfrom, std::string& strCommand, CDat
251246
sumBudgetItemFin += nCount;
252247
countBudgetItemFin++;
253248
break;
254-
}
255-
256-
LogPrint(BCLog::MASTERNODE, "CMasternodeSync:ProcessMessage - ssc - got inventory count %d %d\n", nItemID, nCount);
249+
default:
250+
break;
257251
}
252+
253+
LogPrint(BCLog::MASTERNODE, "CMasternodeSync:ProcessMessage - ssc - got inventory count %d %d\n", nItemID, nCount);
258254
}
259255

260256
void CMasternodeSync::ClearFulfilledRequest()

src/masternode-sync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class CMasternodeSync
7979
void AddedBudgetItem(const uint256& hash);
8080
void SwitchToNextAsset();
8181
std::string GetSyncStatus();
82-
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
82+
void ProcessSyncStatusMsg(int nItemID, int itemCount);
8383
bool IsBudgetFinEmpty();
8484
bool IsBudgetPropEmpty();
8585

src/net_processing.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,6 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
19241924
g_budgetman.ProcessMessage(pfrom, strCommand, vRecv);
19251925
masternodePayments.ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
19261926
sporkManager.ProcessSpork(pfrom, strCommand, vRecv);
1927-
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
19281927
}
19291928
} else {
19301929
// Ignore unknown commands for extensibility

src/tiertwo_networksync.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ bool CMasternodeSync::MessageDispatcher(CNode* pfrom, std::string& strCommand, C
9393
int nCount;
9494
vRecv >> nItemID >> nCount;
9595

96+
// Update stats
97+
ProcessSyncStatusMsg(nItemID, nCount);
98+
9699
// this means we will receive no further communication on the first sync
97100
switch (nItemID) {
98101
case MASTERNODE_SYNC_LIST: {

0 commit comments

Comments
 (0)