@@ -628,13 +628,12 @@ static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman& connma
628
628
}
629
629
}
630
630
connman.ForNode (nodeid, [&connman](CNode* pfrom){
631
- AssertLockHeld ( cs_main);
631
+ LockAssertion lock (:: cs_main);
632
632
uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices () & NODE_WITNESS) ? 2 : 1 ;
633
633
if (lNodesAnnouncingHeaderAndIDs.size () >= 3 ) {
634
634
// As per BIP152, we only get 3 of our peers to announce
635
635
// blocks using compact encodings.
636
636
connman.ForNode (lNodesAnnouncingHeaderAndIDs.front (), [&connman, nCMPCTBLOCKVersion](CNode* pnodeStop){
637
- AssertLockHeld (cs_main);
638
637
connman.PushMessage (pnodeStop, CNetMsgMaker (pnodeStop->GetSendVersion ()).Make (NetMsgType::SENDCMPCT, /* fAnnounceUsingCMPCTBLOCK=*/ false , nCMPCTBLOCKVersion));
639
638
return true ;
640
639
});
@@ -1327,7 +1326,7 @@ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std:
1327
1326
}
1328
1327
1329
1328
m_connman.ForEachNode ([this , &pcmpctblock, pindex, &msgMaker, fWitnessEnabled , &hashBlock](CNode* pnode) {
1330
- AssertLockHeld ( cs_main);
1329
+ LockAssertion lock (:: cs_main);
1331
1330
1332
1331
// TODO: Avoid the repeated-serialization here
1333
1332
if (pnode->nVersion < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect )
@@ -1469,7 +1468,8 @@ void RelayTransaction(const uint256& txid, const uint256& wtxid, const CConnman&
1469
1468
{
1470
1469
connman.ForEachNode ([&txid, &wtxid](CNode* pnode)
1471
1470
{
1472
- AssertLockHeld (cs_main);
1471
+ LockAssertion lock (::cs_main);
1472
+
1473
1473
CNodeState &state = *State (pnode->GetId ());
1474
1474
if (state.m_wtxid_relay ) {
1475
1475
pnode->PushTxInventory (wtxid);
@@ -3957,7 +3957,7 @@ void PeerLogicValidation::EvictExtraOutboundPeers(int64_t time_in_seconds)
3957
3957
int64_t oldest_block_announcement = std::numeric_limits<int64_t >::max ();
3958
3958
3959
3959
m_connman.ForEachNode ([&](CNode* pnode) {
3960
- AssertLockHeld ( cs_main);
3960
+ LockAssertion lock (:: cs_main);
3961
3961
3962
3962
// Ignore non-outbound peers, or nodes marked for disconnect already
3963
3963
if (!pnode->IsOutboundOrBlockRelayConn () || pnode->fDisconnect ) return ;
@@ -3974,7 +3974,7 @@ void PeerLogicValidation::EvictExtraOutboundPeers(int64_t time_in_seconds)
3974
3974
});
3975
3975
if (worst_peer != -1 ) {
3976
3976
bool disconnected = m_connman.ForNode (worst_peer, [&](CNode *pnode) {
3977
- AssertLockHeld ( cs_main);
3977
+ LockAssertion lock (:: cs_main);
3978
3978
3979
3979
// Only disconnect a peer that has been connected to us for
3980
3980
// some reasonable fraction of our check-frequency, to give
0 commit comments