@@ -662,8 +662,8 @@ static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman& connma
662662 return ;
663663 }
664664 }
665- connman.ForNode (nodeid, [&connman](CNode* pfrom){
666- LockAssertion lock (::cs_main);
665+ connman.ForNode (nodeid, [&connman](CNode* pfrom) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
666+ AssertLockHeld (::cs_main);
667667 uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices () & NODE_WITNESS) ? 2 : 1 ;
668668 if (lNodesAnnouncingHeaderAndIDs.size () >= 3 ) {
669669 // As per BIP152, we only get 3 of our peers to announce
@@ -1355,8 +1355,8 @@ void PeerManager::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_
13551355 fWitnessesPresentInMostRecentCompactBlock = fWitnessEnabled ;
13561356 }
13571357
1358- m_connman.ForEachNode ([this , &pcmpctblock, pindex, &msgMaker, fWitnessEnabled , &hashBlock](CNode* pnode) {
1359- LockAssertion lock (::cs_main);
1358+ m_connman.ForEachNode ([this , &pcmpctblock, pindex, &msgMaker, fWitnessEnabled , &hashBlock](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
1359+ AssertLockHeld (::cs_main);
13601360
13611361 // TODO: Avoid the repeated-serialization here
13621362 if (pnode->nVersion < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect )
@@ -1489,9 +1489,8 @@ bool static AlreadyHaveBlock(const uint256& block_hash) EXCLUSIVE_LOCKS_REQUIRED
14891489
14901490void RelayTransaction (const uint256& txid, const uint256& wtxid, const CConnman& connman)
14911491{
1492- connman.ForEachNode ([&txid, &wtxid](CNode* pnode)
1493- {
1494- LockAssertion lock (::cs_main);
1492+ connman.ForEachNode ([&txid, &wtxid](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
1493+ AssertLockHeld (::cs_main);
14951494
14961495 CNodeState* state = State (pnode->GetId ());
14971496 if (state == nullptr ) return ;
@@ -3979,8 +3978,8 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
39793978 NodeId worst_peer = -1 ;
39803979 int64_t oldest_block_announcement = std::numeric_limits<int64_t >::max ();
39813980
3982- m_connman.ForEachNode ([&](CNode* pnode) {
3983- LockAssertion lock (::cs_main);
3981+ m_connman.ForEachNode ([&](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
3982+ AssertLockHeld (::cs_main);
39843983
39853984 // Ignore non-outbound peers, or nodes marked for disconnect already
39863985 if (!pnode->IsOutboundOrBlockRelayConn () || pnode->fDisconnect ) return ;
@@ -3996,8 +3995,8 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
39963995 }
39973996 });
39983997 if (worst_peer != -1 ) {
3999- bool disconnected = m_connman.ForNode (worst_peer, [&](CNode * pnode) {
4000- LockAssertion lock (::cs_main);
3998+ bool disconnected = m_connman.ForNode (worst_peer, [&](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED (::cs_main ) {
3999+ AssertLockHeld (::cs_main);
40014000
40024001 // Only disconnect a peer that has been connected to us for
40034002 // some reasonable fraction of our check-frequency, to give
0 commit comments