From 3115e00f75b41d9765dcbb376e367b25f61a1d58 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Mon, 24 Aug 2020 16:40:10 +0100 Subject: [PATCH] [net processing] Move MaybePunishPeerForTx to PeerManager --- src/net_processing.cpp | 7 +------ src/net_processing.h | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 76913bc4b0f..c99b73bd310 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1182,12 +1182,7 @@ bool PeerManager::MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationSt return false; } -/** - * Potentially disconnect and discourage a node based on the contents of a TxValidationState object - * - * @return Returns true if the peer was punished (probably disconnected) - */ -static bool MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message = "") +bool PeerManager::MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message) { switch (state.GetResult()) { case TxValidationResult::TX_RESULT_UNSET: diff --git a/src/net_processing.h b/src/net_processing.h index 24866efd67a..4f350630f11 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -16,6 +16,7 @@ class CBlockHeader; class CChainParams; class CTxMemPool; class ChainstateManager; +class TxValidationState; extern RecursiveMutex cs_main; extern RecursiveMutex g_cs_orphans; @@ -98,6 +99,13 @@ private: bool MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationState& state, bool via_compact_block, const std::string& message = ""); + /** + * Potentially disconnect and discourage a node based on the contents of a TxValidationState object + * + * @return Returns true if the peer was punished (probably disconnected) + */ + bool MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message = ""); + /** Maybe disconnect a peer and discourage future connections from its address. * * @param[in] pnode The node to check.