aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.h
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2022-09-07 13:57:18 +1000
committerAnthony Towns <aj@erisian.com.au>2022-09-15 14:44:38 +1000
commit1e78f566d575a047a6f0b762bc79601e0208d103 (patch)
treee704563542df1527232220842839705aa9f24fd8 /src/net_processing.h
parent124e75a41ea0f3f0e90b63b0c41813184ddce2ab (diff)
net: add NetEventsInterface::g_msgproc_mutex
There are many cases where we assume message processing is single-threaded in order for how we access node-related memory to be safe. Add an explicit mutex that we can use to document this, which allows the compiler to catch any cases where we try to access that memory from other threads and break that assumption.
Diffstat (limited to 'src/net_processing.h')
-rw-r--r--src/net_processing.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net_processing.h b/src/net_processing.h
index 0a882b1e53..0d0842fa8e 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -84,7 +84,7 @@ public:
/** Process a single message from a peer. Public for fuzz testing */
virtual void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv,
- const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc) = 0;
+ const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(g_msgproc_mutex) = 0;
/** This function is used for testing the stale tip eviction logic, see denialofservice_tests.cpp */
virtual void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds) = 0;