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,433 Lines • ▼ Show 20 Lines | if (!pindex) { | ||||
return -1; | return -1; | ||||
} | } | ||||
// Invalid block | // Invalid block | ||||
if (pindex->nStatus.isInvalid()) { | if (pindex->nStatus.isInvalid()) { | ||||
return 1; | return 1; | ||||
} | } | ||||
// We're polling for this block too, but the vote has been inconclusive for | |||||
// too long, so start rejecting it when peers poll us. | |||||
if (g_avalanche->isInconclusive(pindex)) { | |||||
return 4; | |||||
} | |||||
// Parked block | // Parked block | ||||
if (pindex->nStatus.isOnParkedChain()) { | if (pindex->nStatus.isOnParkedChain()) { | ||||
return 2; | return 2; | ||||
} | } | ||||
const CBlockIndex *pindexTip = ::ChainActive().Tip(); | const CBlockIndex *pindexTip = ::ChainActive().Tip(); | ||||
const CBlockIndex *pindexFork = LastCommonAncestor(pindex, pindexTip); | const CBlockIndex *pindexFork = LastCommonAncestor(pindex, pindexTip); | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static uint32_t getAvalancheVoteForProof(const avalanche::ProofId &id) { | ||||
assert(g_avalanche); | assert(g_avalanche); | ||||
// Rejected proof | // Rejected proof | ||||
if (WITH_LOCK(cs_rejectedProofs, return rejectedProofs->contains(id))) { | if (WITH_LOCK(cs_rejectedProofs, return rejectedProofs->contains(id))) { | ||||
return 1; | return 1; | ||||
} | } | ||||
return g_avalanche->withPeerManager([&id](avalanche::PeerManager &pm) { | return g_avalanche->withPeerManager([&id](avalanche::PeerManager &pm) { | ||||
// We're polling for this proof too, but the vote has been inconclusive | |||||
// for too long, so start rejecting it when peers poll us. | |||||
const auto proof = pm.getProof(id); | |||||
if (g_avalanche->isInconclusive(proof)) { | |||||
return 4; | |||||
} | |||||
// The proof is actively bound to a peer | // The proof is actively bound to a peer | ||||
if (pm.isBoundToPeer(id)) { | if (pm.isBoundToPeer(id)) { | ||||
return 0; | return 0; | ||||
} | } | ||||
// Unknown proof | // Unknown proof | ||||
if (!pm.exists(id)) { | if (!pm.exists(id)) { | ||||
return -1; | return -1; | ||||
▲ Show 20 Lines • Show All 3,532 Lines • Show Last 20 Lines |