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

Function MarkBlockAsInFlight

src/main.cpp:410–423  ·  view source on GitHub ↗

Requires cs_main. returns false, still setting pit, if the block was already in flight from the same peer pit will only be valid as long as the same cs_main lock is being held

Source from the content-addressed store, hash-verified

408// returns false, still setting pit, if the block was already in flight from the same peer
409// pit will only be valid as long as the same cs_main lock is being held
410void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const Consensus::Params& consensusParams, CBlockIndex* pindex = NULL)
411{
412 CNodeState* state = State(nodeid);
413 assert(state != NULL);
414
415 // Make sure it's not listed somewhere already.
416 MarkBlockAsReceived(hash);
417
418 QueuedBlock newentry = {hash, pindex, GetTimeMicros(), nQueuedValidatedHeaders, pindex != NULL};
419 nQueuedValidatedHeaders += newentry.fValidatedHeaders;
420 list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry);
421 state->nBlocksInFlight++;
422 mapBlocksInFlight[hash] = std::make_pair(nodeid, it);
423}
424
425/** Check whether the last unknown block a peer advertized is not yet known. */
426void ProcessBlockAvailability(NodeId nodeid)

Callers 1

SendMessagesFunction · 0.85

Calls 5

MarkBlockAsReceivedFunction · 0.85
GetTimeMicrosFunction · 0.85
StateFunction · 0.70
insertMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected