1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2015 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef BITCOIN_NET_PROCESSING_H
7 #define BITCOIN_NET_PROCESSING_H
10 #include "validationinterface.h"
12 /** Register with a network node to receive its signals */
13 void RegisterNodeSignals(CNodeSignals
& nodeSignals
);
14 /** Unregister a network node */
15 void UnregisterNodeSignals(CNodeSignals
& nodeSignals
);
17 class PeerLogicValidation
: public CValidationInterface
{
22 PeerLogicValidation(CConnman
* connmanIn
);
24 virtual void SyncTransaction(const CTransaction
& tx
, const CBlockIndex
* pindex
, int nPosInBlock
);
25 virtual void UpdatedBlockTip(const CBlockIndex
*pindexNew
, const CBlockIndex
*pindexFork
, bool fInitialDownload
);
26 virtual void BlockChecked(const CBlock
& block
, const CValidationState
& state
);
29 struct CNodeStateStats
{
33 std::vector
<int> vHeightInFlight
;
36 /** Get statistics from node state */
37 bool GetNodeStateStats(NodeId nodeid
, CNodeStateStats
&stats
);
38 /** Increase a node's misbehavior score. */
39 void Misbehaving(NodeId nodeid
, int howmuch
);
41 /** Process protocol messages received from a given node */
42 bool ProcessMessages(CNode
* pfrom
, CConnman
& connman
, std::atomic
<bool>& interrupt
);
44 * Send queued protocol messages to be sent to a give node.
46 * @param[in] pto The node which we are sending messages to.
47 * @param[in] connman The connection manager for that node.
48 * @param[in] interrupt Interrupt condition for processing threads
50 bool SendMessages(CNode
* pto
, CConnman
& connman
, std::atomic
<bool>& interrupt
);
52 #endif // BITCOIN_NET_PROCESSING_H