@@ -452,20 +452,28 @@ class PeerManagerImpl final : public PeerManager
452
452
/* * Expiration-time ordered list of (expire time, relay map entry) pairs. */
453
453
std::deque<std::pair<int64_t , MapRelay::iterator>> vRelayExpiration GUARDED_BY (cs_main);
454
454
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;
455
468
456
469
};
457
470
} // namespace
458
471
459
472
namespace {
460
- /* * Stack of nodes which we have set to announce using compact blocks */
461
- std::list<NodeId> lNodesAnnouncingHeaderAndIDs GUARDED_BY (cs_main);
462
473
463
474
/* * Number of preferable block download peers. */
464
475
int nPreferredDownload GUARDED_BY (cs_main) = 0;
465
476
466
- /* * Number of peers from which we're downloading blocks. */
467
- int nPeersWithValidatedDownloads GUARDED_BY (cs_main) = 0;
468
-
469
477
struct IteratorComparator
470
478
{
471
479
template <typename I>
@@ -731,13 +739,7 @@ static void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) EXCLUSIV
731
739
}
732
740
}
733
741
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)
741
743
{
742
744
AssertLockHeld (cs_main);
743
745
CNodeState* nodestate = State (nodeid);
@@ -753,7 +755,7 @@ static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman& connma
753
755
return ;
754
756
}
755
757
}
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) {
757
759
AssertLockHeld (::cs_main);
758
760
uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices () & NODE_WITNESS) ? 2 : 1 ;
759
761
if (lNodesAnnouncingHeaderAndIDs.size () >= 3 ) {
0 commit comments