Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
// Copyright (c) 2020 The Bitcoin developers | // Copyright (c) 2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AVALANCHE_PEERMANAGER_H | #ifndef BITCOIN_AVALANCHE_PEERMANAGER_H | ||||
#define BITCOIN_AVALANCHE_PEERMANAGER_H | #define BITCOIN_AVALANCHE_PEERMANAGER_H | ||||
#include <avalanche/node.h> | #include <avalanche/node.h> | ||||
#include <avalanche/orphanproofpool.h> | #include <avalanche/orphanproofpool.h> | ||||
#include <avalanche/proof.h> | #include <avalanche/proof.h> | ||||
#include <avalanche/proofcomparator.h> | |||||
#include <coins.h> | #include <coins.h> | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <salteduint256hasher.h> | #include <salteduint256hasher.h> | ||||
#include <util/time.h> | #include <util/time.h> | ||||
#include <boost/multi_index/composite_key.hpp> | #include <boost/multi_index/composite_key.hpp> | ||||
#include <boost/multi_index/hashed_index.hpp> | #include <boost/multi_index/hashed_index.hpp> | ||||
#include <boost/multi_index/member.hpp> | #include <boost/multi_index/member.hpp> | ||||
▲ Show 20 Lines • Show All 268 Lines • ▼ Show 20 Lines | public: | ||||
uint64_t getSlotCount() const { return slotCount; } | uint64_t getSlotCount() const { return slotCount; } | ||||
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 addToPool(ProofPool &pool, const ProofRef &proof); | bool addToPool(ProofPool &pool, const ProofRef &proof, bool allowOverride); | ||||
deadalnix: `bool allowOverride = true` ? | |||||
bool addToPool(ProofPool &pool, const ProofRef &proof) { | |||||
return addToPool(pool, proof, true /* allowOverride */); | |||||
}; | |||||
bool removeFromPool(ProofPool &pool, const ProofRef &proof); | bool removeFromPool(ProofPool &pool, const ProofRef &proof); | ||||
bool createPeer(const ProofRef &proof); | bool createPeer(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); | ||||
friend struct ::avalanche::TestPeerManager; | friend struct ::avalanche::TestPeerManager; | ||||
Show All 11 Lines |
bool allowOverride = true ?