MCPcopy Create free account
hub / github.com/ElementsProject/elements / UpdateBlockAvailability

Method UpdateBlockAvailability

src/net_processing.cpp:1026–1042  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1024}
1025
1026void PeerManagerImpl::UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
1027 CNodeState *state = State(nodeid);
1028 assert(state != nullptr);
1029
1030 ProcessBlockAvailability(nodeid);
1031
1032 const CBlockIndex* pindex = m_chainman.m_blockman.LookupBlockIndex(hash);
1033 if (pindex && pindex->nChainWork > 0) {
1034 // An actually better block was announced.
1035 if (state->pindexBestKnownBlock == nullptr || pindex->nChainWork >= state->pindexBestKnownBlock->nChainWork) {
1036 state->pindexBestKnownBlock = pindex;
1037 }
1038 } else {
1039 // An unknown block was announced; just assume that the latest one is the best one.
1040 state->hashLastUnknownBlock = hash;
1041 }
1042}
1043
1044void PeerManagerImpl::FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller)
1045{

Callers

nothing calls this directly

Calls 2

LookupBlockIndexMethod · 0.80
StateEnum · 0.70

Tested by

no test coverage detected