diff options
author | John Newbery <john@johnnewbery.com> | 2020-08-24 15:56:14 +0100 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2020-09-07 11:16:12 +0100 |
commit | b70cd890e375e904b7f36b3d959e5656f5a5cbcd (patch) | |
tree | 3d8f0f93e37e9545da428157862bd878120d2808 /src/net_processing.h | |
parent | d7778351bf60a21925a97b7fc4e9df5541b6d995 (diff) |
[net processing] Move MaybePunishNodeForBlock into PeerManager
Diffstat (limited to 'src/net_processing.h')
-rw-r--r-- | src/net_processing.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/net_processing.h b/src/net_processing.h index d4793ce303..c0a19f7bd2 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -11,6 +11,7 @@ #include <sync.h> #include <validationinterface.h> +class BlockValidationState; class CBlockHeader; class CChainParams; class CTxMemPool; @@ -84,6 +85,19 @@ public: const std::chrono::microseconds time_received, const std::atomic<bool>& interruptMsgProc); 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. * * @param[in] pnode The node to check. |