MCPcopy Create free account
hub / github.com/LUX-Core/lux / MarkBlockAsReceived

Function MarkBlockAsReceived

src/main.cpp:394–405  ·  view source on GitHub ↗

Requires cs_main.

Source from the content-addressed store, hash-verified

392
393// Requires cs_main.
394void MarkBlockAsReceived(const uint256& hash)
395{
396 map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
397 if (itInFlight != mapBlocksInFlight.end()) {
398 CNodeState* state = State(itInFlight->second.first);
399 nQueuedValidatedHeaders -= itInFlight->second.second->fValidatedHeaders;
400 state->vBlocksInFlight.erase(itInFlight->second.second);
401 state->nBlocksInFlight--;
402 state->nStallingSince = 0;
403 mapBlocksInFlight.erase(itInFlight);
404 }
405}
406
407// Requires cs_main.
408// returns false, still setting pit, if the block was already in flight from the same peer

Callers 2

MarkBlockAsInFlightFunction · 0.85
ProcessNewBlockFunction · 0.85

Calls 4

StateFunction · 0.70
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected