Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 494 Lines • ▼ Show 20 Lines | |||||
bool PeerManager::isOrphan(const ProofId &proofid) const { | bool PeerManager::isOrphan(const ProofId &proofid) const { | ||||
return orphanProofPool.getProof(proofid) != nullptr; | return orphanProofPool.getProof(proofid) != nullptr; | ||||
} | } | ||||
bool PeerManager::isInConflictingPool(const ProofId &proofid) const { | bool PeerManager::isInConflictingPool(const ProofId &proofid) const { | ||||
return conflictingProofPool.getProof(proofid) != nullptr; | return conflictingProofPool.getProof(proofid) != nullptr; | ||||
} | } | ||||
std::optional<std::chrono::seconds> | |||||
PeerManager::getProofRegistrationTime(const ProofId &proofid) const { | |||||
for (auto &pool : {validProofPool, conflictingProofPool, orphanProofPool}) { | |||||
auto registrationTime = pool.getRegistrationTime(proofid); | |||||
if (registrationTime) { | |||||
return registrationTime; | |||||
} | |||||
} | |||||
return {}; | |||||
} | |||||
bool PeerManager::removePeer(const PeerId peerid) { | bool PeerManager::removePeer(const PeerId peerid) { | ||||
auto it = peers.find(peerid); | auto it = peers.find(peerid); | ||||
if (it == peers.end()) { | if (it == peers.end()) { | ||||
return false; | return false; | ||||
} | } | ||||
// Remove all nodes from this peer. | // Remove all nodes from this peer. | ||||
removeNodeFromPeer(it, it->node_count); | removeNodeFromPeer(it, it->node_count); | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |