Skip to content

Commit

Permalink
masternodesync: connect the not-connected ProcessSyncStatusMsg.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
furszy committed Dec 14, 2021
1 parent 281c061 commit ebbef96
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
20 changes: 8 additions & 12 deletions src/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,12 @@ std::string CMasternodeSync::GetSyncStatus()
return "";
}

void CMasternodeSync::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
void CMasternodeSync::ProcessSyncStatusMsg(int nItemID, int nCount)
{
if (strCommand == NetMsgType::SYNCSTATUSCOUNT) { //Sync status count
int nItemID;
int nCount;
vRecv >> nItemID >> nCount;
if (RequestedMasternodeAssets >= MASTERNODE_SYNC_FINISHED) return;

if (RequestedMasternodeAssets >= MASTERNODE_SYNC_FINISHED) return;

//this means we will receive no further communication
switch (nItemID) {
//this means we will receive no further communication
switch (nItemID) {
case (MASTERNODE_SYNC_LIST):
if (nItemID != RequestedMasternodeAssets) return;
sumMasternodeList += nCount;
Expand All @@ -251,10 +246,11 @@ void CMasternodeSync::ProcessMessage(CNode* pfrom, std::string& strCommand, CDat
sumBudgetItemFin += nCount;
countBudgetItemFin++;
break;
}

LogPrint(BCLog::MASTERNODE, "CMasternodeSync:ProcessMessage - ssc - got inventory count %d %d\n", nItemID, nCount);
default:
break;
}

LogPrint(BCLog::MASTERNODE, "CMasternodeSync:ProcessMessage - ssc - got inventory count %d %d\n", nItemID, nCount);
}

void CMasternodeSync::ClearFulfilledRequest()
Expand Down
2 changes: 1 addition & 1 deletion src/masternode-sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CMasternodeSync
void AddedBudgetItem(const uint256& hash);
void SwitchToNextAsset();
std::string GetSyncStatus();
void ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv);
void ProcessSyncStatusMsg(int nItemID, int itemCount);
bool IsBudgetFinEmpty();
bool IsBudgetPropEmpty();

Expand Down
1 change: 0 additions & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,6 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
g_budgetman.ProcessMessage(pfrom, strCommand, vRecv);
masternodePayments.ProcessMessageMasternodePayments(pfrom, strCommand, vRecv);
sporkManager.ProcessSpork(pfrom, strCommand, vRecv);
masternodeSync.ProcessMessage(pfrom, strCommand, vRecv);
}
} else {
// Ignore unknown commands for extensibility
Expand Down
3 changes: 3 additions & 0 deletions src/tiertwo_networksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ bool CMasternodeSync::MessageDispatcher(CNode* pfrom, std::string& strCommand, C
int nCount;
vRecv >> nItemID >> nCount;

// Update stats
ProcessSyncStatusMsg(nItemID, nCount);

// this means we will receive no further communication on the first sync
switch (nItemID) {
case MASTERNODE_SYNC_LIST: {
Expand Down

0 comments on commit ebbef96

Please sign in to comment.