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

Function ProcessBlockAvailability

src/main.cpp:341–352  ·  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

339
340/** Check whether the last unknown block a peer advertized is not yet known. */
341static void ProcessBlockAvailability(NodeStatePtr& state) {
342 AssertLockHeld(cs_main);
343
344 if (!state->hashLastUnknownBlock.IsNull()) {
345 BlockMap::iterator itOld = mapBlockIndex.find(state->hashLastUnknownBlock);
346 if (itOld != mapBlockIndex.end() && itOld->second->nChainWork > 0) {
347 if (state->pindexBestKnownBlock == NULL || itOld->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
348 state->pindexBestKnownBlock = itOld->second;
349 state->hashLastUnknownBlock.SetNull();
350 }
351 }
352}
353
354/** Find the last common ancestor two blocks have.
355 * Both pa and pb must be non-NULL. */

Callers 3

FindNextBlocksToDownloadFunction · 0.85
UpdateBlockAvailabilityFunction · 0.85
SendMessagesFunction · 0.85

Calls 4

findMethod · 0.80
IsNullMethod · 0.45
endMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected