Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 565 Lines • ▼ Show 20 Lines | bool Processor::sendHello(CNode *pfrom) const { | ||||
pfrom->AddKnownProof(peerData->delegation.getProofId()); | pfrom->AddKnownProof(peerData->delegation.getProofId()); | ||||
return true; | return true; | ||||
} | } | ||||
bool Processor::addProof(const std::shared_ptr<Proof> &proof) { | bool Processor::addProof(const std::shared_ptr<Proof> &proof) { | ||||
LOCK(cs_peerManager); | LOCK(cs_peerManager); | ||||
return !peerManager->getProof(proof->getId()) && | return peerManager->registerProof(proof); | ||||
peerManager->getPeerId(proof) != NO_PEER; | |||||
} | } | ||||
std::shared_ptr<Proof> Processor::getProof(const ProofId &proofid) const { | std::shared_ptr<Proof> Processor::getProof(const ProofId &proofid) const { | ||||
LOCK(cs_peerManager); | LOCK(cs_peerManager); | ||||
return peerManager->getProof(proofid); | return peerManager->getProof(proofid); | ||||
} | } | ||||
std::shared_ptr<Proof> Processor::getLocalProof() const { | std::shared_ptr<Proof> Processor::getLocalProof() const { | ||||
return peerData ? peerData->proof : nullptr; | return peerData ? peerData->proof : nullptr; | ||||
} | } | ||||
std::chrono::seconds | |||||
Processor::getProofRegistrationTime(const ProofId &proofid) const { | |||||
LOCK(cs_peerManager); | |||||
return peerManager->getProofRegistrationTime(proofid); | |||||
} | |||||
std::shared_ptr<Proof> Processor::getOrphan(const ProofId &proofid) const { | std::shared_ptr<Proof> Processor::getOrphan(const ProofId &proofid) const { | ||||
LOCK(cs_peerManager); | LOCK(cs_peerManager); | ||||
return peerManager->getOrphan(proofid); | return peerManager->getOrphan(proofid); | ||||
} | } | ||||
bool Processor::startEventLoop(CScheduler &scheduler) { | bool Processor::startEventLoop(CScheduler &scheduler) { | ||||
return eventLoop.startEventLoop( | return eventLoop.startEventLoop( | ||||
scheduler, [this]() { this->runEventLoop(); }, AVALANCHE_TIME_STEP); | scheduler, [this]() { this->runEventLoop(); }, AVALANCHE_TIME_STEP); | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |