MCPcopy Create free account
hub / github.com/dogecoin/dogecoin / ProcessBlockAvailability

Function ProcessBlockAvailability

src/net_processing.cpp:400–412  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

398
399/** Check whether the last unknown block a peer advertised is not yet known. */
400void ProcessBlockAvailability(NodeId nodeid) {
401 CNodeState *state = State(nodeid);
402 assert(state != NULL);
403
404 if (!state->hashLastUnknownBlock.IsNull()) {
405 BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock);
406 if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) {
407 if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
408 state->pindexBestKnownBlock = itOld->second;
409 state->hashLastUnknownBlock.SetNull();
410 }
411 }
412}
413
414/** Update tracking information about which blocks a peer is assumed to have. */
415void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {

Callers 4

UpdateBlockAvailabilityFunction · 0.85
FindNextBlocksToDownloadFunction · 0.85
NewPoWValidBlockMethod · 0.85
SendMessagesFunction · 0.85

Calls 5

findMethod · 0.80
StateFunction · 0.70
IsNullMethod · 0.45
endMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected