Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.h
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | class Processor final : public NetEventsInterface { | ||||
EventLoop eventLoop; | EventLoop eventLoop; | ||||
/** | /** | ||||
* Quorum management. | * Quorum management. | ||||
*/ | */ | ||||
uint32_t minQuorumScore; | uint32_t minQuorumScore; | ||||
double minQuorumConnectedScoreRatio; | double minQuorumConnectedScoreRatio; | ||||
std::atomic<bool> quorumIsEstablished{false}; | std::atomic<bool> quorumIsEstablished{false}; | ||||
int64_t minAvaproofsNodeCount; | |||||
std::atomic<int64_t> avaproofsNodeCounter{0}; | |||||
/** Voting parameters. */ | /** Voting parameters. */ | ||||
const uint32_t staleVoteThreshold; | const uint32_t staleVoteThreshold; | ||||
const uint32_t staleVoteFactor; | const uint32_t staleVoteFactor; | ||||
/** Registered interfaces::Chain::Notifications handler. */ | /** Registered interfaces::Chain::Notifications handler. */ | ||||
class NotificationsHandler; | class NotificationsHandler; | ||||
std::unique_ptr<interfaces::Handler> chainNotificationsHandler; | std::unique_ptr<interfaces::Handler> chainNotificationsHandler; | ||||
Processor(const ArgsManager &argsman, interfaces::Chain &chain, | Processor(const ArgsManager &argsman, interfaces::Chain &chain, | ||||
CConnman *connmanIn, std::unique_ptr<PeerData> peerDataIn, | CConnman *connmanIn, std::unique_ptr<PeerData> peerDataIn, | ||||
CKey sessionKeyIn, uint32_t minQuorumTotalScoreIn, | CKey sessionKeyIn, uint32_t minQuorumTotalScoreIn, | ||||
double minQuorumConnectedScoreRatioIn, | double minQuorumConnectedScoreRatioIn, | ||||
uint32_t staleVoteThresholdIn, uint32_t staleVoteFactorIn); | int64_t minAvaproofsNodeCountIn, uint32_t staleVoteThresholdIn, | ||||
uint32_t staleVoteFactorIn); | |||||
public: | public: | ||||
~Processor(); | ~Processor(); | ||||
static std::unique_ptr<Processor> MakeProcessor(const ArgsManager &argsman, | static std::unique_ptr<Processor> MakeProcessor(const ArgsManager &argsman, | ||||
interfaces::Chain &chain, | interfaces::Chain &chain, | ||||
CConnman *connman, | CConnman *connman, | ||||
bilingual_str &error); | bilingual_str &error); | ||||
Show All 29 Lines | public: | ||||
/* | /* | ||||
* Return whether the avalanche service flag should be set. | * Return whether the avalanche service flag should be set. | ||||
*/ | */ | ||||
bool isAvalancheServiceAvailable() { return !!peerData; } | bool isAvalancheServiceAvailable() { return !!peerData; } | ||||
bool startEventLoop(CScheduler &scheduler); | bool startEventLoop(CScheduler &scheduler); | ||||
bool stopEventLoop(); | bool stopEventLoop(); | ||||
void avaproofsSent(NodeId nodeid); | |||||
bool isQuorumEstablished(); | bool isQuorumEstablished(); | ||||
// Implement NetEventInterface. Only FinalizeNode is of interest. | // Implement NetEventInterface. Only FinalizeNode is of interest. | ||||
void InitializeNode(const Config &config, CNode *pnode) override {} | void InitializeNode(const Config &config, CNode *pnode) override {} | ||||
bool ProcessMessages(const Config &config, CNode *pnode, | bool ProcessMessages(const Config &config, CNode *pnode, | ||||
std::atomic<bool> &interrupt) override { | std::atomic<bool> &interrupt) override { | ||||
return false; | return false; | ||||
} | } | ||||
Show All 26 Lines |