Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 605 Lines • ▼ Show 20 Lines | void Processor::clearTimedoutRequests() { | ||||
if (timedout_items.empty()) { | if (timedout_items.empty()) { | ||||
return; | return; | ||||
} | } | ||||
// In flight request accounting. | // In flight request accounting. | ||||
for (const auto &p : timedout_items) { | for (const auto &p : timedout_items) { | ||||
const CInv &inv = p.first; | const CInv &inv = p.first; | ||||
if (inv.type != MSG_BLOCK) { | if (inv.IsMsgBlk()) { | ||||
continue; | |||||
} | |||||
CBlockIndex *pindex; | CBlockIndex *pindex; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
pindex = LookupBlockIndex(BlockHash(inv.hash)); | pindex = LookupBlockIndex(BlockHash(inv.hash)); | ||||
if (!pindex) { | if (!pindex) { | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
auto w = blockVoteRecords.getWriteView(); | auto w = blockVoteRecords.getWriteView(); | ||||
auto it = w->find(pindex); | auto it = w->find(pindex); | ||||
if (it == w.end()) { | if (it == w.end()) { | ||||
continue; | continue; | ||||
} | } | ||||
it->second.clearInflightRequest(p.second); | it->second.clearInflightRequest(p.second); | ||||
} | } | ||||
if (inv.IsMsgProof()) { | |||||
auto w = proofVoteRecords.getWriteView(); | |||||
for (auto it = w.begin(); it != w.end(); it++) { | |||||
if (it->first->getId() == inv.hash) { | |||||
it->second.clearInflightRequest(p.second); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
void Processor::runEventLoop() { | void Processor::runEventLoop() { | ||||
// Don't do Avalanche while node is IBD'ing | // Don't do Avalanche while node is IBD'ing | ||||
if (::ChainstateActive().IsInitialBlockDownload()) { | if (::ChainstateActive().IsInitialBlockDownload()) { | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |