Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.h
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | void forEachNode(const Peer &peer, Callable &&func) const { | ||||
for (auto it = range.first; it != range.second; ++it) { | for (auto it = range.first; it != range.second; ++it) { | ||||
func(*it); | func(*it); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Proof and Peer related API. | * Proof and Peer related API. | ||||
*/ | */ | ||||
bool exists(const ProofId &proofid) const { | |||||
return getProof(proofid) != nullptr; | |||||
} | |||||
template <typename Callable> void forEachPeer(Callable &&func) const { | template <typename Callable> void forEachPeer(Callable &&func) const { | ||||
for (const auto &p : peers) { | for (const auto &p : peers) { | ||||
func(p); | func(p); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Update the peer set when a new block is connected. | * Update the peer set when a new block is connected. | ||||
*/ | */ | ||||
void updatedBlockTip(); | void updatedBlockTip(); | ||||
/** | /** | ||||
* Proof broadcast API. | * Proof broadcast API. | ||||
*/ | */ | ||||
void addUnbroadcastProof(const ProofId &proofid); | void addUnbroadcastProof(const ProofId &proofid); | ||||
void removeUnbroadcastProof(const ProofId &proofid); | void removeUnbroadcastProof(const ProofId &proofid); | ||||
void broadcastProofs(const CConnman &connman); | auto getUnbroadcastProofs() const { return m_unbroadcast_proofids; } | ||||
/**************************************************** | /**************************************************** | ||||
* Functions which are public for testing purposes. * | * Functions which are public for testing purposes. * | ||||
****************************************************/ | ****************************************************/ | ||||
/** | /** | ||||
* Provide the PeerId associated with the given proof. If the peer does not | * Provide the PeerId associated with the given proof. If the peer does not | ||||
* exist, then it is created. | * exist, then it is created. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |