Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.h
Show All 23 Lines | |||||
*/ | */ | ||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; | static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100; | ||||
/** | /** | ||||
* Default number of orphan+recently-replaced txn to keep around for block | * Default number of orphan+recently-replaced txn to keep around for block | ||||
* reconstruction. | * reconstruction. | ||||
*/ | */ | ||||
static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100; | static const unsigned int DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN = 100; | ||||
static const bool DEFAULT_PEERBLOCKFILTERS = false; | static const bool DEFAULT_PEERBLOCKFILTERS = false; | ||||
/** Threshold for marking a node to be discouraged, e.g. disconnected and added | |||||
* to the discouragement filter. */ | |||||
static const int DISCOURAGEMENT_THRESHOLD{100}; | |||||
class PeerLogicValidation final : public CValidationInterface, | class PeerLogicValidation final : public CValidationInterface, | ||||
public NetEventsInterface { | public NetEventsInterface { | ||||
private: | private: | ||||
CConnman *const connman; | CConnman *const connman; | ||||
BanMan *const m_banman; | BanMan *const m_banman; | ||||
ChainstateManager &m_chainman; | ChainstateManager &m_chainman; | ||||
CTxMemPool &m_mempool; | CTxMemPool &m_mempool; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | struct CNodeStateStats { | ||||
int nMisbehavior = 0; | int nMisbehavior = 0; | ||||
int nSyncHeight = -1; | int nSyncHeight = -1; | ||||
int nCommonHeight = -1; | int nCommonHeight = -1; | ||||
std::vector<int> vHeightInFlight; | std::vector<int> vHeightInFlight; | ||||
}; | }; | ||||
/** Get statistics from node state */ | /** Get statistics from node state */ | ||||
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats); | bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats); | ||||
/** Increase a node's misbehavior score. */ | /** | ||||
* Increment peer's misbehavior score. If the new value >= | |||||
* DISCOURAGEMENT_THRESHOLD, mark the node to be discouraged, meaning the peer | |||||
* might be disconnected and added to the discouragement filter. | |||||
*/ | |||||
void Misbehaving(NodeId nodeid, int howmuch, const std::string &message = "") | void Misbehaving(NodeId nodeid, int howmuch, const std::string &message = "") | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main); | EXCLUSIVE_LOCKS_REQUIRED(cs_main); | ||||
/** Relay transaction to every node */ | /** Relay transaction to every node */ | ||||
void RelayTransaction(const TxId &txid, const CConnman &connman); | void RelayTransaction(const TxId &txid, const CConnman &connman); | ||||
bool ProcessMessage(const Config &config, CNode &pfrom, | bool ProcessMessage(const Config &config, CNode &pfrom, | ||||
const std::string &msg_type, CDataStream &vRecv, | const std::string &msg_type, CDataStream &vRecv, | ||||
int64_t nTimeReceived, CTxMemPool &mempool, | int64_t nTimeReceived, CTxMemPool &mempool, | ||||
ChainstateManager &chainman, CConnman &connman, | ChainstateManager &chainman, CConnman &connman, | ||||
BanMan *banman, const std::atomic<bool> &interruptMsgProc); | BanMan *banman, const std::atomic<bool> &interruptMsgProc); | ||||
#endif // BITCOIN_NET_PROCESSING_H | #endif // BITCOIN_NET_PROCESSING_H |