Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
Show First 20 Lines • Show All 348 Lines • ▼ Show 20 Lines | |||||
// peer. | // peer. | ||||
static bool MarkBlockAsReceived(const uint256 &hash) | static bool MarkBlockAsReceived(const uint256 &hash) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | ||||
std::map<uint256, | std::map<uint256, | ||||
std::pair<NodeId, std::list<QueuedBlock>::iterator>>::iterator | std::pair<NodeId, std::list<QueuedBlock>::iterator>>::iterator | ||||
itInFlight = mapBlocksInFlight.find(hash); | itInFlight = mapBlocksInFlight.find(hash); | ||||
if (itInFlight != mapBlocksInFlight.end()) { | if (itInFlight != mapBlocksInFlight.end()) { | ||||
CNodeState *state = State(itInFlight->second.first); | CNodeState *state = State(itInFlight->second.first); | ||||
assert(state != nullptr); | |||||
state->nBlocksInFlightValidHeaders -= | state->nBlocksInFlightValidHeaders -= | ||||
itInFlight->second.second->fValidatedHeaders; | itInFlight->second.second->fValidatedHeaders; | ||||
if (state->nBlocksInFlightValidHeaders == 0 && | if (state->nBlocksInFlightValidHeaders == 0 && | ||||
itInFlight->second.second->fValidatedHeaders) { | itInFlight->second.second->fValidatedHeaders) { | ||||
// Last validated block on the queue was received. | // Last validated block on the queue was received. | ||||
nPeersWithValidatedDownloads--; | nPeersWithValidatedDownloads--; | ||||
} | } | ||||
if (state->vBlocksInFlight.begin() == itInFlight->second.second) { | if (state->vBlocksInFlight.begin() == itInFlight->second.second) { | ||||
▲ Show 20 Lines • Show All 4,000 Lines • Show Last 20 Lines |