Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.h
Show All 29 Lines | |||||
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 | /** Threshold for marking a node to be discouraged, e.g. disconnected and added | ||||
* to the discouragement filter. */ | * to the discouragement filter. */ | ||||
static const int DISCOURAGEMENT_THRESHOLD{100}; | static const int DISCOURAGEMENT_THRESHOLD{100}; | ||||
class PeerLogicValidation final : public CValidationInterface, | class PeerLogicValidation final : public CValidationInterface, | ||||
public NetEventsInterface { | public NetEventsInterface { | ||||
private: | |||||
CConnman &m_connman; | |||||
/** | |||||
* Pointer to this node's banman. May be nullptr - check existence before | |||||
* dereferencing. | |||||
*/ | |||||
BanMan *const m_banman; | |||||
ChainstateManager &m_chainman; | |||||
CTxMemPool &m_mempool; | |||||
bool MaybeDiscourageAndDisconnect(CNode &pnode); | |||||
public: | public: | ||||
PeerLogicValidation(CConnman &connman, BanMan *banman, | PeerLogicValidation(CConnman &connman, BanMan *banman, | ||||
CScheduler &scheduler, ChainstateManager &chainman, | CScheduler &scheduler, ChainstateManager &chainman, | ||||
CTxMemPool &pool); | CTxMemPool &pool); | ||||
/** | /** | ||||
* Overridden from CValidationInterface. | * Overridden from CValidationInterface. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | public: | ||||
/** Process a single message from a peer. Public for fuzz testing */ | /** Process a single message from a peer. Public for fuzz testing */ | ||||
void ProcessMessage(const Config &config, CNode &pfrom, | void ProcessMessage(const Config &config, CNode &pfrom, | ||||
const std::string &msg_type, CDataStream &vRecv, | const std::string &msg_type, CDataStream &vRecv, | ||||
int64_t nTimeReceived, | int64_t nTimeReceived, | ||||
const std::atomic<bool> &interruptMsgProc); | const std::atomic<bool> &interruptMsgProc); | ||||
private: | private: | ||||
/** | |||||
* Maybe disconnect a peer and discourage future connections from its | |||||
* address. | |||||
* | |||||
* @param[in] pnode The node to check. | |||||
* @return True if the peer was marked for disconnection in | |||||
* this function | |||||
*/ | |||||
bool MaybeDiscourageAndDisconnect(CNode &pnode); | |||||
CConnman &m_connman; | |||||
/** | |||||
* Pointer to this node's banman. May be nullptr - check existence before | |||||
* dereferencing. | |||||
*/ | |||||
BanMan *const m_banman; | |||||
ChainstateManager &m_chainman; | |||||
CTxMemPool &m_mempool; | |||||
//! Next time to check for stale tip | //! Next time to check for stale tip | ||||
int64_t m_stale_tip_check_time; | int64_t m_stale_tip_check_time; | ||||
}; | }; | ||||
struct CNodeStateStats { | struct CNodeStateStats { | ||||
int m_misbehavior_score = 0; | int m_misbehavior_score = 0; | ||||
int nSyncHeight = -1; | int nSyncHeight = -1; | ||||
int nCommonHeight = -1; | int nCommonHeight = -1; | ||||
Show All 17 Lines |