refactor: Make ProcessMessage private again
What changed, and why it matters
This commit is a simple code cleanup: it moves a message-processing function back from 'public' to 'private' because no test code calls it directly anymore. There is no change to what the function does, no bug fix, and no security-relevant behavior change.
No security action needed. Review as normal code-quality refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit changes ProcessMessage from a public virtual method (exposed for fuzz testing) to a private non-virtual method in PeerManagerImpl. The declaration is removed from the public NetEventsInterface in net_processing.h. The function body is unchanged. This is purely an access-control refactor with no functional or security impact.
Changed components
src/net_processing.cppsrc/net_processing.hInspect captured patch +4 / −7
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 16b4735e..34425948 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -551,13 +551,14 @@ public:
m_best_block_time = time;
};
void UnitTestMisbehaving(NodeId peer_id) override EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex) { Misbehaving(*Assert(GetPeerRef(peer_id)), ""); };
- void ProcessMessage(CNode& pfrom, const std::string& msg_type, DataStream& vRecv,
- std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc) override
- EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_most_recent_block_mutex, !m_headers_presync_mutex, g_msgproc_mutex, !m_tx_download_mutex);
void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds) override;
ServiceFlags GetDesirableServiceFlags(ServiceFlags services) const override;
private:
+ void ProcessMessage(CNode& pfrom, const std::string& msg_type, DataStream& vRecv, std::chrono::microseconds time_received,
+ const std::atomic<bool>& interruptMsgProc)
+ EXCLUSIVE_LOCKS_REQUIRED(!m_peer_mutex, !m_most_recent_block_mutex, !m_headers_presync_mutex, g_msgproc_mutex, !m_tx_download_mutex);
+
/** Consider evicting an outbound peer based on the amount of time they've been behind our tip */
void ConsiderEviction(CNode& pto, Peer& peer, std::chrono::seconds time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_msgproc_mutex);
diff --git a/src/net_processing.h b/src/net_processing.h
index 4b221c5d..504e708d 100644
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -147,10 +147,6 @@ public:
*/
virtual void CheckForStaleTipAndEvictPeers() = 0;
- /** Process a single message from a peer. Public for fuzz testing */
- virtual void ProcessMessage(CNode& pfrom, const std::string& msg_type, DataStream& vRecv,
- 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;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.