Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.h
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* How many inflight requests can exist for one item. | * How many inflight requests can exist for one item. | ||||
*/ | */ | ||||
static constexpr int AVALANCHE_MAX_INFLIGHT_POLL = 10; | static constexpr int AVALANCHE_MAX_INFLIGHT_POLL = 10; | ||||
namespace avalanche { | namespace avalanche { | ||||
class PeerManager; | class PeerManager; | ||||
class Proof; | |||||
/** | /** | ||||
* Vote history. | * Vote history. | ||||
*/ | */ | ||||
struct VoteRecord { | struct VoteRecord { | ||||
private: | private: | ||||
// confidence's LSB bit is the result. Higher bits are actual confidence | // confidence's LSB bit is the result. Higher bits are actual confidence | ||||
// score. | // score. | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | public: | ||||
bool isAccepted(const CBlockIndex *pindex) const; | bool isAccepted(const CBlockIndex *pindex) const; | ||||
int getConfidence(const CBlockIndex *pindex) const; | int getConfidence(const CBlockIndex *pindex) const; | ||||
// TDOD: Refactor the API to remove the dependency on avalanche/protocol.h | // TDOD: Refactor the API to remove the dependency on avalanche/protocol.h | ||||
void sendResponse(CNode *pfrom, Response response) const; | void sendResponse(CNode *pfrom, Response response) const; | ||||
bool registerVotes(NodeId nodeid, const Response &response, | bool registerVotes(NodeId nodeid, const Response &response, | ||||
std::vector<BlockUpdate> &updates); | std::vector<BlockUpdate> &updates); | ||||
bool addPeer(NodeId nodeid, int64_t score, const CPubKey &pubkey); | bool addPeer(NodeId nodeid, const Proof &proof, const CPubKey &pubkey); | ||||
bool forNode(NodeId nodeid, std::function<bool(const Node &n)> func) const; | bool forNode(NodeId nodeid, std::function<bool(const Node &n)> func) const; | ||||
CPubKey getSessionPubKey() const { return sessionKey.GetPubKey(); } | CPubKey getSessionPubKey() const { return sessionKey.GetPubKey(); } | ||||
bool startEventLoop(CScheduler &scheduler); | bool startEventLoop(CScheduler &scheduler); | ||||
bool stopEventLoop(); | bool stopEventLoop(); | ||||
private: | private: | ||||
Show All 16 Lines |