Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show All 28 Lines | |||||
/** | /** | ||||
* Is proof replacement enabled by default. | * Is proof replacement enabled by default. | ||||
*/ | */ | ||||
static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_ENABLED = false; | static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_ENABLED = false; | ||||
namespace avalanche { | namespace avalanche { | ||||
/** | /** | ||||
* Maximum number of proofs to store per utxo. This will allow for conflict | |||||
* resolution when several proofs claim the same utxo. | |||||
*/ | |||||
static constexpr size_t AVALANCHE_MAXPROOF_PER_UTXO = 1; | |||||
/** | |||||
* 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; | ||||
class Delegation; | class Delegation; | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | class PeerManager { | ||||
/** | /** | ||||
* 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; | ||||
public: | public: | ||||
// Limit the pool to a depth to a single proof per utxo | // Limit the pool to a depth to a single proof per utxo | ||||
PeerManager() : pool(1) {} | PeerManager(size_t maxProofsPerUtxo = AVALANCHE_MAXPROOF_PER_UTXO) | ||||
: pool(maxProofsPerUtxo) {} | |||||
/** | /** | ||||
* 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. | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |