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

Function ProcessBlockAvailability

src/main.cpp:426–439  ·  view source on GitHub ↗

Check whether the last unknown block a peer advertized is not yet known. */

Source from the content-addressed store, hash-verified

424
425/** Check whether the last unknown block a peer advertized is not yet known. */
426void ProcessBlockAvailability(NodeId nodeid)
427{
428 CNodeState* state = State(nodeid);
429 assert(state != NULL);
430
431 if (state->hashLastUnknownBlock != 0) {
432 CBlockIndex* pindex = LookupBlockIndex(state->hashLastUnknownBlock);
433 if (pindex && pindex->nChainWork > 0) {
434 if (state->pindexBestKnownBlock == NULL || pindex->nChainWork >= state->pindexBestKnownBlock->nChainWork)
435 state->pindexBestKnownBlock = pindex;
436 state->hashLastUnknownBlock = uint256(0);
437 }
438 }
439}
440
441/** Update tracking information about which blocks a peer is assumed to have. */
442void UpdateBlockAvailability(NodeId nodeid, const uint256& hash)

Callers 2

UpdateBlockAvailabilityFunction · 0.85
FindNextBlocksToDownloadFunction · 0.85

Calls 3

LookupBlockIndexFunction · 0.85
StateFunction · 0.70
uint256Class · 0.70

Tested by

no test coverage detected