@@ -452,20 +452,28 @@ class PeerManagerImpl final : public PeerManager
452452 /* * Expiration-time ordered list of (expire time, relay map entry) pairs. */
453453 std::deque<std::pair<int64_t , MapRelay::iterator>> vRelayExpiration GUARDED_BY (cs_main);
454454
455+ /* *
456+ * When a peer sends us a valid block, instruct it to announce blocks to us
457+ * using CMPCTBLOCK if possible by adding its nodeid to the end of
458+ * lNodesAnnouncingHeaderAndIDs, and keeping that list under a certain size by
459+ * removing the first element if necessary.
460+ */
461+ void MaybeSetPeerAsAnnouncingHeaderAndIDs (NodeId nodeid, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
462+
463+ /* * Stack of nodes which we have set to announce using compact blocks */
464+ std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY (cs_main);
465+
466+ /* * Number of peers from which we're downloading blocks. */
467+ int nPeersWithValidatedDownloads GUARDED_BY (cs_main) = 0;
455468
456469};
457470} // namespace
458471
459472namespace {
460- /* * Stack of nodes which we have set to announce using compact blocks */
461- std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY (cs_main);
462473
463474 /* * Number of preferable block download peers. */
464475 int nPreferredDownload GUARDED_BY (cs_main) = 0;
465476
466- /* * Number of peers from which we're downloading blocks. */
467- int nPeersWithValidatedDownloads GUARDED_BY (cs_main) = 0;
468-
469477 struct IteratorComparator
470478 {
471479 template <typename I>
@@ -731,13 +739,7 @@ static void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) EXCLUSIV
731739 }
732740}
733741
734- /* *
735- * When a peer sends us a valid block, instruct it to announce blocks to us
736- * using CMPCTBLOCK if possible by adding its nodeid to the end of
737- * lNodesAnnouncingHeaderAndIDs, and keeping that list under a certain size by
738- * removing the first element if necessary.
739- */
740- static void MaybeSetPeerAsAnnouncingHeaderAndIDs (NodeId nodeid, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
742+ void PeerManagerImpl::MaybeSetPeerAsAnnouncingHeaderAndIDs (NodeId nodeid, CConnman& connman) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
741743{
742744 AssertLockHeld (cs_main);
743745 CNodeState* nodestate = State (nodeid);
@@ -753,7 +755,7 @@ static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman& connma
753755 return ;
754756 }
755757 }
756- connman.ForNode (nodeid, [&connman](CNode* pfrom) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
758+ connman.ForNode (nodeid, [this , &connman](CNode* pfrom) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
757759 AssertLockHeld (::cs_main);
758760 uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices () & NODE_WITNESS) ? 2 : 1 ;
759761 if (lNodesAnnouncingHeaderAndIDs.size () >= 3 ) {
0 commit comments