Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | bool Processor::registerVotes(NodeId nodeid, const Response &response, | ||||
std::map<CBlockIndex *, Vote> responseIndex; | std::map<CBlockIndex *, Vote> responseIndex; | ||||
std::map<ProofRef, Vote> responseProof; | std::map<ProofRef, Vote> responseProof; | ||||
// At this stage we are certain that invs[i] matches votes[i], so we can use | // At this stage we are certain that invs[i] matches votes[i], so we can use | ||||
// the inv type to retrieve what is being voted on. | // the inv type to retrieve what is being voted on. | ||||
for (size_t i = 0; i < size; i++) { | for (size_t i = 0; i < size; i++) { | ||||
if (invs[i].IsMsgBlk()) { | if (invs[i].IsMsgBlk()) { | ||||
CBlockIndex *pindex; | |||||
{ | |||||
LOCK(cs_main); | LOCK(cs_main); | ||||
auto pindex = LookupBlockIndex(BlockHash(votes[i].GetHash())); | pindex = LookupBlockIndex(BlockHash(votes[i].GetHash())); | ||||
if (!pindex) { | if (!pindex) { | ||||
// This should not happen, but just in case... | // This should not happen, but just in case... | ||||
continue; | continue; | ||||
} | } | ||||
if (!IsWorthPolling(pindex)) { | if (!IsWorthPolling(pindex)) { | ||||
// There is no point polling this block. | // There is no point polling this block. | ||||
continue; | continue; | ||||
} | } | ||||
} | |||||
responseIndex.insert(std::make_pair(pindex, votes[i])); | responseIndex.insert(std::make_pair(pindex, votes[i])); | ||||
} | } | ||||
if (invs[i].IsMsgProof()) { | if (invs[i].IsMsgProof()) { | ||||
const ProofId proofid(votes[i].GetHash()); | const ProofId proofid(votes[i].GetHash()); | ||||
const ProofRef proof = WITH_LOCK( | const ProofRef proof = WITH_LOCK( | ||||
▲ Show 20 Lines • Show All 299 Lines • Show Last 20 Lines |