diff --git a/src/net_processing.h b/src/net_processing.h --- a/src/net_processing.h +++ b/src/net_processing.h @@ -14,6 +14,7 @@ extern RecursiveMutex cs_main; extern RecursiveMutex g_cs_orphans; +class BlockValidationState; class CBlockHeader; class CTxMemPool; class ChainstateManager; @@ -124,6 +125,23 @@ void ReattemptInitialBroadcast(CScheduler &scheduler) const; private: + /** + * Potentially mark a node discouraged based on the contents of a + * BlockValidationState object + * + * @param[in] via_compact_block this bool is passed in because + * net_processing should punish peers differently depending on whether the + * data was provided in a compact block message or not. If the compact block + * had a valid header, but contained invalid txs, the peer should not be + * punished. See BIP 152. + * + * @return Returns true if the peer was punished (probably disconnected) + */ + bool MaybePunishNodeForBlock(NodeId nodeid, + const BlockValidationState &state, + bool via_compact_block, + const std::string &message = ""); + /** * Maybe disconnect a peer and discourage future connections from its * address. diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1362,20 +1362,10 @@ return state.GetResult() == TxValidationResult::TX_CONSENSUS; } -/** - * Potentially ban a node based on the contents of a BlockValidationState object - * - * @param[in] via_compact_block this bool is passed in because net_processing - * should punish peers differently depending on whether the data was provided in - * a compact block message or not. If the compact block had a valid header, but - * contained invalid txs, the peer should not be punished. See BIP 152. - * - * @return Returns true if the peer was punished (probably disconnected) - */ -static bool MaybePunishNodeForBlock(NodeId nodeid, - const BlockValidationState &state, - bool via_compact_block, - const std::string &message = "") { +bool PeerManager::MaybePunishNodeForBlock(NodeId nodeid, + const BlockValidationState &state, + bool via_compact_block, + const std::string &message) { switch (state.GetResult()) { case BlockValidationResult::BLOCK_RESULT_UNSET: break;