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

Method ProcessBlockAvailability

src/net_processing.cpp:1372–1385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1370}
1371
1372void PeerManagerImpl::ProcessBlockAvailability(NodeId nodeid) {
1373 CNodeState *state = State(nodeid);
1374 assert(state != nullptr);
1375
1376 if (!state->hashLastUnknownBlock.IsNull()) {
1377 const CBlockIndex* pindex = m_chainman.m_blockman.LookupBlockIndex(state->hashLastUnknownBlock);
1378 if (pindex && pindex->nChainWork > 0) {
1379 if (state->pindexBestKnownBlock == nullptr || pindex->nChainWork >= state->pindexBestKnownBlock->nChainWork) {
1380 state->pindexBestKnownBlock = pindex;
1381 }
1382 state->hashLastUnknownBlock.SetNull();
1383 }
1384 }
1385}
1386
1387void PeerManagerImpl::UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
1388 CNodeState *state = State(nodeid);

Callers

nothing calls this directly

Calls 4

LookupBlockIndexMethod · 0.80
StateEnum · 0.70
IsNullMethod · 0.45
SetNullMethod · 0.45

Tested by

no test coverage detected