| 1454 | } |
| 1455 | |
| 1456 | void PeerManagerImpl::TryDownloadingHistoricalBlocks(const Peer& peer, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, const CBlockIndex *from_tip, const CBlockIndex* target_block) |
| 1457 | { |
| 1458 | Assert(from_tip); |
| 1459 | Assert(target_block); |
| 1460 | |
| 1461 | if (vBlocks.size() >= count) { |
| 1462 | return; |
| 1463 | } |
| 1464 | |
| 1465 | vBlocks.reserve(count); |
| 1466 | CNodeState *state = Assert(State(peer.m_id)); |
| 1467 | |
| 1468 | if (state->pindexBestKnownBlock == nullptr || state->pindexBestKnownBlock->GetAncestor(target_block->nHeight) != target_block) { |
| 1469 | // This peer can't provide us the complete series of blocks leading up to the |
| 1470 | // assumeutxo snapshot base. |
| 1471 | // |
| 1472 | // Presumably this peer's chain has less work than our ActiveChain()'s tip, or else we |
| 1473 | // will eventually crash when we try to reorg to it. Let other logic |
| 1474 | // deal with whether we disconnect this peer. |
| 1475 | // |
| 1476 | // TODO at some point in the future, we might choose to request what blocks |
| 1477 | // this peer does have from the historical chain, despite it not having a |
| 1478 | // complete history beneath the snapshot base. |
| 1479 | return; |
| 1480 | } |
| 1481 | |
| 1482 | FindNextBlocks(vBlocks, peer, state, from_tip, count, std::min<int>(from_tip->nHeight + BLOCK_DOWNLOAD_WINDOW, target_block->nHeight)); |
| 1483 | } |
| 1484 | |
| 1485 | void PeerManagerImpl::FindNextBlocks(std::vector<const CBlockIndex*>& vBlocks, const Peer& peer, CNodeState *state, const CBlockIndex *pindexWalk, unsigned int count, int nWindowEnd, const CChain* activeChain, NodeId* nodeStaller) |
| 1486 | { |
nothing calls this directly
no test coverage detected