aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-06 16:58:53 +0200
committerMacroFake <falke.marco@gmail.com>2022-08-16 17:26:40 +0200
commitfac04cb6ba1d032587bd02eab2247fd655a548cd (patch)
treebe6149a2a37ee881bccb119e08a1260a237d4a99 /src/net_processing.cpp
parentfac15ff673f0d6f84ea1eaae855597da02b0e510 (diff)
downloadbitcoin-fac04cb6ba1d032587bd02eab2247fd655a548cd.tar.xz
refactor: Add lock annotations to Active* methods
This is a refactor, putting the burden to think about thread safety to the caller. Otherwise, there is a risk that the caller will assume thread safety where none exists, as is evident in the previous two commits.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index ed78ae5a81..b39412158f 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2510,7 +2510,7 @@ void PeerManagerImpl::ProcessHeadersMessage(CNode& pfrom, Peer& peer,
// Consider fetching more headers.
if (nCount == MAX_HEADERS_RESULTS) {
// Headers message had its maximum size; the peer may have more headers.
- if (MaybeSendGetHeaders(pfrom, m_chainman.ActiveChain().GetLocator(pindexLast), peer)) {
+ if (MaybeSendGetHeaders(pfrom, WITH_LOCK(m_chainman.GetMutex(), return m_chainman.ActiveChain().GetLocator(pindexLast)), peer)) {
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n",
pindexLast->nHeight, pfrom.GetId(), peer.m_starting_height);
}