Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show All 20 Lines | |||||
#include <boost/multi_index_container.hpp> | #include <boost/multi_index_container.hpp> | ||||
#include <chrono> | #include <chrono> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <memory> | #include <memory> | ||||
#include <unordered_set> | #include <unordered_set> | ||||
#include <vector> | #include <vector> | ||||
/** | |||||
* Is proof replacement enabled by default. | |||||
*/ | |||||
static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_ENABLED = false; | |||||
namespace avalanche { | namespace avalanche { | ||||
/** | /** | ||||
* Maximum number of stakes in the orphanProofs. | * Maximum number of stakes in the orphanProofs. | ||||
* Benchmarking on a consumer grade computer shows that 10000 stakes can be | * Benchmarking on a consumer grade computer shows that 10000 stakes can be | ||||
* verified in less than 1 second. | * verified in less than 1 second. | ||||
*/ | */ | ||||
static constexpr size_t AVALANCHE_ORPHANPROOFPOOL_SIZE = 10000; | static constexpr size_t AVALANCHE_ORPHANPROOFPOOL_SIZE = 10000; | ||||
▲ Show 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | public: | ||||
uint64_t getFragmentation() const { return fragmentation; } | uint64_t getFragmentation() const { return fragmentation; } | ||||
ProofRef getProof(const ProofId &proofid) const; | ProofRef getProof(const ProofId &proofid) const; | ||||
bool isValid(const ProofId &proofid) const; | bool isValid(const ProofId &proofid) const; | ||||
bool isOrphan(const ProofId &proofid) const; | bool isOrphan(const ProofId &proofid) const; | ||||
private: | private: | ||||
bool createPeer(const ProofRef &proof); | bool createPeer(const ProofRef &proof); | ||||
bool removePeer(const ProofRef &proof); | |||||
bool addOrUpdateNode(const PeerSet::iterator &it, NodeId nodeid); | bool addOrUpdateNode(const PeerSet::iterator &it, NodeId nodeid); | ||||
bool addNodeToPeer(const PeerSet::iterator &it); | bool addNodeToPeer(const PeerSet::iterator &it); | ||||
bool removeNodeFromPeer(const PeerSet::iterator &it, uint32_t count = 1); | bool removeNodeFromPeer(const PeerSet::iterator &it, uint32_t count = 1); | ||||
bool addProofToPool(const ProofRef &proof); | bool addProofToPool(const ProofRef &proof); | ||||
friend struct ::avalanche::TestPeerManager; | friend struct ::avalanche::TestPeerManager; | ||||
}; | }; | ||||
Show All 10 Lines |