Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 3,975 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::INV) { | ||||
} | } | ||||
if (inv.IsMsgProof()) { | if (inv.IsMsgProof()) { | ||||
const avalanche::ProofId proofid(inv.hash); | const avalanche::ProofId proofid(inv.hash); | ||||
const bool fAlreadyHave = AlreadyHaveProof(proofid); | const bool fAlreadyHave = AlreadyHaveProof(proofid); | ||||
logInv(inv, fAlreadyHave); | logInv(inv, fAlreadyHave); | ||||
pfrom.AddKnownProof(proofid); | pfrom.AddKnownProof(proofid); | ||||
if (!fAlreadyHave && g_avalanche && isAvalancheEnabled(gArgs)) { | if (!fAlreadyHave && g_avalanche && isAvalancheEnabled(gArgs) && | ||||
!m_chainman.ActiveChainstate().IsInitialBlockDownload()) { | |||||
const bool preferred = isPreferredDownloadPeer(pfrom); | const bool preferred = isPreferredDownloadPeer(pfrom); | ||||
LOCK(cs_proofrequest); | LOCK(cs_proofrequest); | ||||
AddProofAnnouncement(pfrom, proofid, current_time, | AddProofAnnouncement(pfrom, proofid, current_time, | ||||
preferred); | preferred); | ||||
} | } | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,085 Lines • ▼ Show 20 Lines | |||||
bool PeerManagerImpl::ReceivedAvalancheProof(CNode &peer, | bool PeerManagerImpl::ReceivedAvalancheProof(CNode &peer, | ||||
const avalanche::ProofRef &proof) { | const avalanche::ProofRef &proof) { | ||||
assert(proof != nullptr); | assert(proof != nullptr); | ||||
const avalanche::ProofId &proofid = proof->getId(); | const avalanche::ProofId &proofid = proof->getId(); | ||||
peer.AddKnownProof(proofid); | peer.AddKnownProof(proofid); | ||||
if (m_chainman.ActiveChainstate().IsInitialBlockDownload()) { | |||||
// We cannot reliably verify proofs during IBD, so bail out early and | |||||
// keep the inventory as pending so it can be requested when the node | |||||
// has synced. | |||||
return true; | |||||
} | |||||
const NodeId nodeid = peer.GetId(); | const NodeId nodeid = peer.GetId(); | ||||
{ | { | ||||
LOCK(cs_proofrequest); | LOCK(cs_proofrequest); | ||||
m_proofrequest.ReceivedResponse(nodeid, proofid); | m_proofrequest.ReceivedResponse(nodeid, proofid); | ||||
if (AlreadyHaveProof(proofid)) { | if (AlreadyHaveProof(proofid)) { | ||||
m_proofrequest.ForgetInvId(proofid); | m_proofrequest.ForgetInvId(proofid); | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |