Skip to content

Commit 3115e00

Browse files
committed
[net processing] Move MaybePunishPeerForTx to PeerManager
1 parent e662e2d commit 3115e00

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,12 +1182,7 @@ bool PeerManager::MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationSt
11821182
return false;
11831183
}
11841184

1185-
/**
1186-
* Potentially disconnect and discourage a node based on the contents of a TxValidationState object
1187-
*
1188-
* @return Returns true if the peer was punished (probably disconnected)
1189-
*/
1190-
static bool MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message = "")
1185+
bool PeerManager::MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message)
11911186
{
11921187
switch (state.GetResult()) {
11931188
case TxValidationResult::TX_RESULT_UNSET:

src/net_processing.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class CBlockHeader;
1616
class CChainParams;
1717
class CTxMemPool;
1818
class ChainstateManager;
19+
class TxValidationState;
1920

2021
extern RecursiveMutex cs_main;
2122
extern RecursiveMutex g_cs_orphans;
@@ -98,6 +99,13 @@ class PeerManager final : public CValidationInterface, public NetEventsInterface
9899
bool MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationState& state,
99100
bool via_compact_block, const std::string& message = "");
100101

102+
/**
103+
* Potentially disconnect and discourage a node based on the contents of a TxValidationState object
104+
*
105+
* @return Returns true if the peer was punished (probably disconnected)
106+
*/
107+
bool MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message = "");
108+
101109
/** Maybe disconnect a peer and discourage future connections from its address.
102110
*
103111
* @param[in] pnode The node to check.

0 commit comments

Comments
 (0)