Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/peermanager.cpp
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
std::shared_ptr<Proof> PeerManager::getProof(const ProofId &proofid) const { | std::shared_ptr<Proof> PeerManager::getProof(const ProofId &proofid) const { | ||||
auto &pview = peers.get<proof_index>(); | auto &pview = peers.get<proof_index>(); | ||||
auto it = pview.find(proofid); | auto it = pview.find(proofid); | ||||
return it == pview.end() ? nullptr : it->proof; | return it == pview.end() ? nullptr : it->proof; | ||||
} | } | ||||
Peer::Timestamp PeerManager::getProofTime(const ProofId &proofid) const { | std::chrono::seconds | ||||
PeerManager::getProofRegistrationTime(const ProofId &proofid) const { | |||||
auto &pview = peers.get<proof_index>(); | auto &pview = peers.get<proof_index>(); | ||||
auto it = pview.find(proofid); | auto it = pview.find(proofid); | ||||
return it == pview.end() ? Peer::Timestamp::max() : it->time; | return it == pview.end() ? std::chrono::seconds::max() | ||||
: it->registration_time; | |||||
} | } | ||||
PeerManager::PeerSet::iterator | PeerManager::PeerSet::iterator | ||||
PeerManager::fetchOrCreatePeer(const std::shared_ptr<Proof> &proof) { | PeerManager::fetchOrCreatePeer(const std::shared_ptr<Proof> &proof) { | ||||
{ | { | ||||
// Check if we already know of that peer. | // Check if we already know of that peer. | ||||
auto &pview = peers.get<proof_index>(); | auto &pview = peers.get<proof_index>(); | ||||
auto it = pview.find(proof->getId()); | auto it = pview.find(proof->getId()); | ||||
▲ Show 20 Lines • Show All 309 Lines • Show Last 20 Lines |