Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche.h
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
}; | }; | ||||
class AvalanchePoll { | class AvalanchePoll { | ||||
uint64_t round; | uint64_t round; | ||||
std::vector<CInv> invs; | std::vector<CInv> invs; | ||||
public: | public: | ||||
AvalanchePoll(uint32_t roundIn, std::vector<CInv> invsIn) | AvalanchePoll(uint64_t roundIn, std::vector<CInv> invsIn) | ||||
: round(roundIn), invs(invsIn) {} | : round(roundIn), invs(invsIn) {} | ||||
const std::vector<CInv> &GetInvs() const { return invs; } | const std::vector<CInv> &GetInvs() const { return invs; } | ||||
// serialization support | // serialization support | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | public: | ||||
bool addBlockToReconcile(const CBlockIndex *pindex); | bool addBlockToReconcile(const CBlockIndex *pindex); | ||||
bool isAccepted(const CBlockIndex *pindex) const; | bool isAccepted(const CBlockIndex *pindex) const; | ||||
int getConfidence(const CBlockIndex *pindex) const; | int getConfidence(const CBlockIndex *pindex) const; | ||||
bool registerVotes(NodeId nodeid, const AvalancheResponse &response, | bool registerVotes(NodeId nodeid, const AvalancheResponse &response, | ||||
std::vector<AvalancheBlockUpdate> &updates); | std::vector<AvalancheBlockUpdate> &updates); | ||||
bool addPeer(NodeId nodeid, uint32_t score); | bool addPeer(NodeId nodeid, int64_t score); | ||||
bool startEventLoop(CScheduler &scheduler); | bool startEventLoop(CScheduler &scheduler); | ||||
bool stopEventLoop(); | bool stopEventLoop(); | ||||
private: | private: | ||||
void runEventLoop(); | void runEventLoop(); | ||||
std::vector<CInv> getInvsForNextPoll() const; | std::vector<CInv> getInvsForNextPoll() const; | ||||
NodeId getSuitableNodeToQuery(); | NodeId getSuitableNodeToQuery(); | ||||
friend struct AvalancheTest; | friend struct AvalancheTest; | ||||
}; | }; | ||||
#endif // BITCOIN_AVALANCHE_H | #endif // BITCOIN_AVALANCHE_H |