Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show All 24 Lines | |||||
#include <atomic> | #include <atomic> | ||||
#include <chrono> | #include <chrono> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <memory> | #include <memory> | ||||
#include <unordered_set> | #include <unordered_set> | ||||
#include <vector> | #include <vector> | ||||
class CScheduler; | |||||
namespace avalanche { | namespace avalanche { | ||||
/** | /** | ||||
* Maximum number of orphan proofs the peer manager will accept from the | * Maximum number of orphan proofs the peer manager will accept from the | ||||
* network. Under good conditions, this allows the node to collect relevant | * network. Under good conditions, this allows the node to collect relevant | ||||
* proofs during IBD. Note that reorgs can cause the orphan pool to | * proofs during IBD. Note that reorgs can cause the orphan pool to | ||||
* temporarily exceed this limit. But a change in chaintip cause previously | * temporarily exceed this limit. But a change in chaintip cause previously | ||||
* reorged proofs to be trimmed. | * reorged proofs to be trimmed. | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | class PeerManager { | ||||
/** | /** | ||||
* Quorum management. | * Quorum management. | ||||
*/ | */ | ||||
uint32_t totalPeersScore = 0; | uint32_t totalPeersScore = 0; | ||||
uint32_t connectedPeersScore = 0; | uint32_t connectedPeersScore = 0; | ||||
public: | public: | ||||
PeerManager(CScheduler &scheduler); | |||||
/** | /** | ||||
* 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); | ||||
size_t getNodeCount() const { return nodes.size(); } | size_t getNodeCount() const { return nodes.size(); } | ||||
size_t getPendingNodeCount() const { return pendingNodes.size(); } | size_t getPendingNodeCount() const { return pendingNodes.size(); } | ||||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |