Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | class PeerManager { | ||||
*/ | */ | ||||
OrphanProofPool orphanProofs{AVALANCHE_ORPHANPROOFPOOL_SIZE}; | OrphanProofPool orphanProofs{AVALANCHE_ORPHANPROOFPOOL_SIZE}; | ||||
/** | /** | ||||
* Track proof ids to broadcast | * Track proof ids to broadcast | ||||
*/ | */ | ||||
std::unordered_set<ProofId, SaltedProofIdHasher> m_unbroadcast_proofids; | std::unordered_set<ProofId, SaltedProofIdHasher> m_unbroadcast_proofids; | ||||
/** | |||||
* Track proof ids from conflicting proofs | |||||
*/ | |||||
std::unordered_set<ProofId, SaltedProofIdHasher> m_conflicting_proofids; | |||||
public: | public: | ||||
class ConflictingProofHandler { | class ConflictingProofHandler { | ||||
public: | public: | ||||
virtual void onConflictingProof(const std::shared_ptr<Proof> &proof, | virtual void onConflictingProof(const std::shared_ptr<Proof> &proof, | ||||
bool accepted) {} | bool accepted) {} | ||||
virtual ~ConflictingProofHandler() {} | virtual ~ConflictingProofHandler() {} | ||||
}; | }; | ||||
std::unordered_set<std::shared_ptr<ConflictingProofHandler>> | std::unordered_set<std::shared_ptr<ConflictingProofHandler>> | ||||
conflictingProofHandlers; | conflictingProofHandlers; | ||||
/** Conflicting proof callback */ | /** Conflicting proofs API */ | ||||
std::unique_ptr<interfaces::Handler> | std::unique_ptr<interfaces::Handler> | ||||
handleConflictingProof(std::shared_ptr<ConflictingProofHandler> handler); | handleConflictingProof(std::shared_ptr<ConflictingProofHandler> handler); | ||||
bool isConflictingProof(const ProofId &proofid) const; | |||||
/** | /** | ||||
* Node API. | * Node API. | ||||
*/ | */ | ||||
bool addNode(NodeId nodeid, const ProofId &proofid); | bool addNode(NodeId nodeid, const ProofId &proofid); | ||||
bool removeNode(NodeId nodeid); | bool removeNode(NodeId nodeid); | ||||
// Update when a node is to be polled next. | // Update when a node is to be polled next. | ||||
bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); | bool updateNextRequestTime(NodeId nodeid, TimePoint timeout); | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |