Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 2,062 Lines • ▼ Show 20 Lines | FindProofForGetData(const CNode &peer, const avalanche::ProofId &proofid, | ||||
const std::chrono::seconds now) { | const std::chrono::seconds now) { | ||||
auto proof = g_avalanche->getProof(proofid); | auto proof = g_avalanche->getProof(proofid); | ||||
// We don't have this proof | // We don't have this proof | ||||
if (!proof) { | if (!proof) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
auto proofTime = std::chrono::duration_cast<std::chrono::seconds>( | auto proofRegistrationTime = g_avalanche->getProofRegistrationTime(proofid); | ||||
g_avalanche->getProofTime(proofid).time_since_epoch()); | |||||
// If we know that proof for long enough, allow for requesting it | // If we know that proof for long enough, allow for requesting it | ||||
if (proofTime <= now - UNCONDITIONAL_RELAY_DELAY) { | if (proofRegistrationTime <= now - UNCONDITIONAL_RELAY_DELAY) { | ||||
return proof; | return proof; | ||||
} | } | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
// Otherwise, the proofs must have been announced recently. | // Otherwise, the proofs must have been announced recently. | ||||
if (State(peer.GetId()) | if (State(peer.GetId()) | ||||
->m_recently_announced_proofs.contains(proofid)) { | ->m_recently_announced_proofs.contains(proofid)) { | ||||
▲ Show 20 Lines • Show All 3,766 Lines • Show Last 20 Lines |