Prior to this commit callers of FindNode(...)
were required to be holding cs_vNodes
in the cases where they used the returned CNode*
for anything aside from existence-checking (see #9626).
This resulted in locking cs_vNodes
twice since FindNode(...)
had a LOCK(cs_vNodes);
.
To solve this and to make the locking requirements more explicit this commit does the following:
- Add explicit locking requirements for
FindNode(...)
usingEXCLUSIVE_LOCKS_REQUIRED(cs_vNodes)
. - Remove the now redundant
LOCK(cs_vNodes)
inFindNode(...)
. - Add a method
CConnman::NodeExists(...)
for existence-checking. Calling this method does not require holdingcs_vNodes
.