* Special handling for unconnecting headers that might be part of a block * announcement. * * We'll send a getheaders message in response to try to connect the chain. */
| 2680 | * We'll send a getheaders message in response to try to connect the chain. |
| 2681 | */ |
| 2682 | void PeerManagerImpl::HandleUnconnectingHeaders(CNode& pfrom, Peer& peer, |
| 2683 | const std::vector<CBlockHeader>& headers) |
| 2684 | { |
| 2685 | // Try to fill in the missing headers. |
| 2686 | const CBlockIndex* best_header{WITH_LOCK(cs_main, return m_chainman.m_best_header)}; |
| 2687 | if (MaybeSendGetHeaders(pfrom, GetLocator(best_header), peer)) { |
| 2688 | LogDebug(BCLog::NET, "received header %s: missing prev block %s, sending getheaders (%d) to end (peer=%d)\n", |
| 2689 | headers[0].GetHash().ToString(), |
| 2690 | headers[0].hashPrevBlock.ToString(), |
| 2691 | best_header->nHeight, |
| 2692 | pfrom.GetId()); |
| 2693 | } |
| 2694 | |
| 2695 | // Set hashLastUnknownBlock for this peer, so that if we |
| 2696 | // eventually get the headers - even from a different peer - |
| 2697 | // we can use this peer to download. |
| 2698 | WITH_LOCK(cs_main, UpdateBlockAvailability(pfrom.GetId(), headers.back().GetHash())); |
| 2699 | } |
| 2700 | |
| 2701 | bool PeerManagerImpl::CheckHeadersAreContinuous(const std::vector<CBlockHeader>& headers) const |
| 2702 | { |
nothing calls this directly
no test coverage detected