Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < size; i++) { | ||||
} | } | ||||
} | } | ||||
std::map<CBlockIndex *, Vote> responseIndex; | std::map<CBlockIndex *, Vote> responseIndex; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
for (const auto &v : votes) { | for (const auto &v : votes) { | ||||
BlockMap::iterator mi = mapBlockIndex.find(BlockHash(v.GetHash())); | auto pindex = LookupBlockIndex(BlockHash(v.GetHash())); | ||||
if (mi == mapBlockIndex.end()) { | if (!pindex) { | ||||
// This should not happen, but just in case... | // This should not happen, but just in case... | ||||
continue; | continue; | ||||
} | } | ||||
CBlockIndex *pindex = mi->second; | |||||
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, v)); | responseIndex.insert(std::make_pair(pindex, v)); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | void Processor::clearTimedoutRequests() { | ||||
for (const auto &p : timedout_items) { | for (const auto &p : timedout_items) { | ||||
const CInv &inv = p.first; | const CInv &inv = p.first; | ||||
assert(inv.type == MSG_BLOCK); | assert(inv.type == MSG_BLOCK); | ||||
CBlockIndex *pindex; | CBlockIndex *pindex; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
BlockMap::iterator mi = mapBlockIndex.find(BlockHash(inv.hash)); | pindex = LookupBlockIndex(BlockHash(inv.hash)); | ||||
if (mi == mapBlockIndex.end()) { | if (!pindex) { | ||||
continue; | continue; | ||||
} | } | ||||
pindex = mi->second; | |||||
} | } | ||||
auto w = vote_records.getWriteView(); | auto w = vote_records.getWriteView(); | ||||
auto it = w->find(pindex); | auto it = w->find(pindex); | ||||
if (it == w.end()) { | if (it == w.end()) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |