[net processing] Move MaybePunishPeerForTx to PeerManager
This commit is contained in:
1 parent
e662e2d42a
commit
3115e00f75
2 files changed
+9
-6
No files matched your search
@@ -1182,12 +1182,7 @@ bool PeerManager::MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationSt
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool PeerManager::MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, 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)
|
|
||||||
*/
|
|
||||||
static bool MaybePunishNodeForTx(NodeId nodeid, const TxValidationState& state, const std::string& message = "")
|
|
||||||
{
|
{
|
||||||
switch (state.GetResult()) {
|
switch (state.GetResult()) {
|
||||||
case TxValidationResult::TX_RESULT_UNSET:
|
case TxValidationResult::TX_RESULT_UNSET:
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class CBlockHeader;
|
|||||||
class CChainParams;
|
class CChainParams;
|
||||||
class CTxMemPool;
|
class CTxMemPool;
|
||||||
class ChainstateManager;
|
class ChainstateManager;
|
||||||
|
class TxValidationState;
|
||||||
|
|
||||||
extern RecursiveMutex cs_main;
|
extern RecursiveMutex cs_main;
|
||||||
extern RecursiveMutex g_cs_orphans;
|
extern RecursiveMutex g_cs_orphans;
|
||||||
@@ -98,6 +99,13 @@ private:
|
|||||||
bool MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationState& state,
|
bool MaybePunishNodeForBlock(NodeId nodeid, const BlockValidationState& state,
|
||||||
bool via_compact_block, const std::string& message = "");
|
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.
|
/** Maybe disconnect a peer and discourage future connections from its address.
|
||||||
*
|
*
|
||||||
* @param[in] pnode The node to check.
|
* @param[in] pnode The node to check.
|
||||||
|
|||||||
Reference in new issue
Block a user