Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.h
Show All 19 Lines | |||||
#include <boost/multi_index/member.hpp> | #include <boost/multi_index/member.hpp> | ||||
#include <boost/multi_index/ordered_index.hpp> | #include <boost/multi_index/ordered_index.hpp> | ||||
#include <boost/multi_index_container.hpp> | #include <boost/multi_index_container.hpp> | ||||
#include <atomic> | #include <atomic> | ||||
#include <chrono> | #include <chrono> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <memory> | #include <memory> | ||||
#include <unordered_set> | |||||
#include <vector> | #include <vector> | ||||
class ArgsManager; | class ArgsManager; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CConnman; | class CConnman; | ||||
class CNode; | class CNode; | ||||
class CScheduler; | class CScheduler; | ||||
class Config; | class Config; | ||||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | static std::unique_ptr<Processor> MakeProcessor(const ArgsManager &argsman, | ||||
CConnman *connman, | CConnman *connman, | ||||
bilingual_str &error); | bilingual_str &error); | ||||
void setQueryTimeoutDuration(std::chrono::milliseconds d) { | void setQueryTimeoutDuration(std::chrono::milliseconds d) { | ||||
queryTimeoutDuration = d; | queryTimeoutDuration = d; | ||||
} | } | ||||
bool addBlockToReconcile(const CBlockIndex *pindex); | bool addBlockToReconcile(const CBlockIndex *pindex); | ||||
void addProofToReconcile(const std::shared_ptr<Proof> &proof, | void | ||||
addProofToReconcile(const std::shared_ptr<Proof> &proof, | |||||
const std::unordered_set<PeerId> &conflictingPeerIds, | |||||
bool isAccepted); | bool isAccepted); | ||||
bool isAccepted(const CBlockIndex *pindex) const; | bool isAccepted(const CBlockIndex *pindex) const; | ||||
int getConfidence(const CBlockIndex *pindex) const; | int getConfidence(const CBlockIndex *pindex) const; | ||||
// TODO: Refactor the API to remove the dependency on avalanche/protocol.h | // TODO: 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, int &banscore, | std::vector<BlockUpdate> &updates, int &banscore, | ||||
std::string &error); | std::string &error); | ||||
Show All 23 Lines | private: | ||||
NodeId getSuitableNodeToQuery(); | NodeId getSuitableNodeToQuery(); | ||||
/** | /** | ||||
* Build and return the challenge whose signature is included in the | * Build and return the challenge whose signature is included in the | ||||
* AVAHELLO message that we send to a peer. | * AVAHELLO message that we send to a peer. | ||||
*/ | */ | ||||
uint256 buildLocalSighash(CNode *pfrom) const; | uint256 buildLocalSighash(CNode *pfrom) const; | ||||
/** Test API */ | |||||
friend struct ::avalanche::AvalancheTest; | friend struct ::avalanche::AvalancheTest; | ||||
void setPeerData(const std::shared_ptr<Proof> proof, const Delegation &dg, | |||||
PeerId peerid); | |||||
}; | }; | ||||
} // namespace avalanche | } // namespace avalanche | ||||
#endif // BITCOIN_AVALANCHE_PROCESSOR_H | #endif // BITCOIN_AVALANCHE_PROCESSOR_H |