@@ -662,8 +662,8 @@ static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman& connma
662
662
return ;
663
663
}
664
664
}
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);
667
667
uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices () & NODE_WITNESS) ? 2 : 1 ;
668
668
if (lNodesAnnouncingHeaderAndIDs.size () >= 3 ) {
669
669
// 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_
1355
1355
fWitnessesPresentInMostRecentCompactBlock = fWitnessEnabled ;
1356
1356
}
1357
1357
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);
1360
1360
1361
1361
// TODO: Avoid the repeated-serialization here
1362
1362
if (pnode->nVersion < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect )
@@ -1489,9 +1489,8 @@ bool static AlreadyHaveBlock(const uint256& block_hash) EXCLUSIVE_LOCKS_REQUIRED
1489
1489
1490
1490
void RelayTransaction (const uint256& txid, const uint256& wtxid, const CConnman& connman)
1491
1491
{
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);
1495
1494
1496
1495
CNodeState* state = State (pnode->GetId ());
1497
1496
if (state == nullptr ) return ;
@@ -3979,8 +3978,8 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
3979
3978
NodeId worst_peer = -1 ;
3980
3979
int64_t oldest_block_announcement = std::numeric_limits<int64_t >::max ();
3981
3980
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);
3984
3983
3985
3984
// Ignore non-outbound peers, or nodes marked for disconnect already
3986
3985
if (!pnode->IsOutboundOrBlockRelayConn () || pnode->fDisconnect ) return ;
@@ -3996,8 +3995,8 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds)
3996
3995
}
3997
3996
});
3998
3997
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);
4001
4000
4002
4001
// Only disconnect a peer that has been connected to us for
4003
4002
// some reasonable fraction of our check-frequency, to give
0 commit comments