| 1024 | } |
| 1025 | |
| 1026 | void 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 | |
| 1044 | void PeerManagerImpl::FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller) |
| 1045 | { |
nothing calls this directly
no test coverage detected