1919
2020class CConnman ;
2121
22- void SyncManager::Schedule (CScheduler& scheduler, CConnman& connman )
22+ void SyncManager::Schedule (CScheduler& scheduler)
2323{
2424 scheduler.scheduleEvery (
25- [this , &connman ]() -> void {
25+ [this ]() -> void {
2626 if (ShutdownRequested ()) return ;
27- ProcessTick (connman );
27+ ProcessTick ();
2828 },
2929 std::chrono::seconds{1 });
3030}
3131
32- void SyncManager::SendGovernanceSyncRequest (CNode* pnode, CConnman& connman ) const
32+ void SyncManager::SendGovernanceSyncRequest (CNode* pnode) const
3333{
3434 CNetMsgMaker msgMaker (pnode->GetCommonVersion ());
3535 CBloomFilter filter;
36- connman .PushMessage (pnode, msgMaker.Make (NetMsgType::MNGOVERNANCESYNC, uint256 (), filter));
36+ m_connman .PushMessage (pnode, msgMaker.Make (NetMsgType::MNGOVERNANCESYNC, uint256 (), filter));
3737}
3838
39- int SyncManager::RequestGovernanceObjectVotes (const std::vector<CNode*>& vNodesCopy, CConnman& connman ) const
39+ int SyncManager::RequestGovernanceObjectVotes (const std::vector<CNode*>& vNodesCopy) const
4040{
4141 // Maximum number of nodes to request votes from for the same object hash on real networks
4242 // (mainnet, testnet, devnets). Keep this low to avoid unnecessary bandwidth usage.
@@ -97,7 +97,7 @@ int SyncManager::RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesC
9797 // Don't try to sync any data from outbound non-relay "masternode" connections.
9898 // Inbound connection this early is most likely a "masternode" connection
9999 // initiated from another node, so skip it too.
100- if (!pnode->CanRelay () || (connman .IsActiveMasternode () && pnode->IsInboundConn ())) continue ;
100+ if (!pnode->CanRelay () || (m_connman .IsActiveMasternode () && pnode->IsInboundConn ())) continue ;
101101 // stop early to prevent setAskFor overflow
102102 {
103103 LOCK (::cs_main);
@@ -107,7 +107,7 @@ int SyncManager::RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesC
107107 // to early to ask the same node
108108 if (mapAskedRecently[nHashGovobj].count (pnode->addr )) continue ;
109109
110- m_gov_manager.RequestGovernanceObject (pnode, nHashGovobj, connman , true );
110+ m_gov_manager.RequestGovernanceObject (pnode, nHashGovobj, m_connman , true );
111111 mapAskedRecently[nHashGovobj][pnode->addr ] = nNow + nTimeout;
112112 fAsked = true ;
113113 // stop loop if max number of peers per obj was asked
@@ -127,7 +127,7 @@ int SyncManager::RequestGovernanceObjectVotes(const std::vector<CNode*>& vNodesC
127127 return int (vTriggerObjHashes.size () + vOtherObjHashes.size ());
128128}
129129
130- void SyncManager::ProcessTick (CConnman& connman )
130+ void SyncManager::ProcessTick ()
131131{
132132 assert (m_netfulfilledman.IsValid ());
133133
@@ -139,7 +139,7 @@ void SyncManager::ProcessTick(CConnman& connman)
139139
140140 // reset the sync process if the last call to this function was more than 60 minutes ago (client was in sleep mode)
141141 static int64_t nTimeLastProcess = GetTime ();
142- if (!Params ().IsMockableChain () && GetTime () - nTimeLastProcess > 60 * 60 && !connman .IsActiveMasternode ()) {
142+ if (!Params ().IsMockableChain () && GetTime () - nTimeLastProcess > 60 * 60 && !m_connman .IsActiveMasternode ()) {
143143 LogPrintf (" Sync Tick -- WARNING: no actions for too long, restarting sync...\n " );
144144 m_node_sync.Reset (true );
145145 nTimeLastProcess = GetTime ();
@@ -152,11 +152,11 @@ void SyncManager::ProcessTick(CConnman& connman)
152152 }
153153
154154 nTimeLastProcess = GetTime ();
155- const CConnman::NodesSnapshot snap{connman , /* cond = */ CConnman::FullyConnectedOnly};
155+ const CConnman::NodesSnapshot snap{m_connman , /* cond = */ CConnman::FullyConnectedOnly};
156156
157157 // gradually request the rest of the votes after sync finished
158158 if (m_node_sync.IsSynced ()) {
159- RequestGovernanceObjectVotes (snap.Nodes (), connman );
159+ RequestGovernanceObjectVotes (snap.Nodes ());
160160 return ;
161161 }
162162
@@ -175,7 +175,7 @@ void SyncManager::ProcessTick(CConnman& connman)
175175 // Don't try to sync any data from outbound non-relay "masternode" connections.
176176 // Inbound connection this early is most likely a "masternode" connection
177177 // initiated from another node, so skip it too.
178- if (!pnode->CanRelay () || (connman .IsActiveMasternode () && pnode->IsInboundConn ())) continue ;
178+ if (!pnode->CanRelay () || (m_connman .IsActiveMasternode () && pnode->IsInboundConn ())) continue ;
179179
180180 {
181181 if ((pnode->HasPermission (NetPermissionFlags::NoBan) || pnode->IsManualConn ()) &&
@@ -199,7 +199,7 @@ void SyncManager::ProcessTick(CConnman& connman)
199199 // always get sporks first, only request once from each peer
200200 m_netfulfilledman.AddFulfilledRequest (pnode->addr , " spork-sync" );
201201 // get current network sporks
202- connman .PushMessage (pnode, msgMaker.Make (NetMsgType::GETSPORKS));
202+ m_connman .PushMessage (pnode, msgMaker.Make (NetMsgType::GETSPORKS));
203203 LogPrint (BCLog::MNSYNC, " Sync Tick -- nTick %d asset_id %d -- requesting sporks from peer=%d\n " , nTick,
204204 asset_id, pnode->GetId ());
205205 }
@@ -227,7 +227,7 @@ void SyncManager::ProcessTick(CConnman& connman)
227227 " mempool-sync" );
228228 if (!pNodeTmp->IsInboundConn () && !fRequestedEarlier && !pNodeTmp->IsBlockRelayOnly ()) {
229229 m_netfulfilledman.AddFulfilledRequest (pNodeTmp->addr , " mempool-sync" );
230- connman .PushMessage (pNodeTmp, msgMaker.Make (NetMsgType::MEMPOOL));
230+ m_connman .PushMessage (pNodeTmp, msgMaker.Make (NetMsgType::MEMPOOL));
231231 LogPrint (BCLog::MNSYNC, /* Continued */
232232 " Sync Tick -- nTick %d asset_id %d -- syncing mempool from peer=%d\n " , nTick,
233233 asset_id, pNodeTmp->GetId ());
@@ -268,7 +268,7 @@ void SyncManager::ProcessTick(CConnman& connman)
268268
269269 m_node_sync.BumpAttempt ();
270270
271- SendGovernanceSyncRequest (pnode, connman );
271+ SendGovernanceSyncRequest (pnode);
272272
273273 break ; // this will cause each peer to get one request each six seconds for the various assets we need
274274 }
@@ -287,7 +287,7 @@ void SyncManager::ProcessTick(CConnman& connman)
287287 continue ; // to early for this node
288288 }
289289 const std::vector<CNode*> vNodeCopy{pnode};
290- int nObjsLeftToAsk = RequestGovernanceObjectVotes (vNodeCopy, connman );
290+ int nObjsLeftToAsk = RequestGovernanceObjectVotes (vNodeCopy);
291291 // check for data
292292 if (nObjsLeftToAsk == 0 ) {
293293 static int64_t nTimeNoObjectsLeft = 0 ;
@@ -319,7 +319,7 @@ void SyncManager::ProcessTick(CConnman& connman)
319319 }
320320}
321321
322- void SyncManager::ProcessMessage (CNode& peer, CConnman&, const std::string& msg_type, CDataStream& vRecv)
322+ void SyncManager::ProcessMessage (CNode& peer, const std::string& msg_type, CDataStream& vRecv)
323323{
324324 // Sync status count
325325 if (msg_type != NetMsgType::SYNCSTATUSCOUNT) return ;
0 commit comments