|
|
@ -5158,8 +5158,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
// Headers message had its maximum size; the peer may have more headers.
|
|
|
|
// TODO: optimize: if pindexLast is an ancestor of chainActive.Tip or pindexBestHeader, continue
|
|
|
|
// from there instead.
|
|
|
|
LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); |
|
|
|
pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); |
|
|
|
if ( pfrom->sendhdrsreq >= chainActive.Height()-MAX_HEADERS_RESULTS || pindexLast->nHeight != pfrom->sendhdrsreq ) |
|
|
|
{ |
|
|
|
pfrom->sendhdrsreq = (int32_t)pindexLast->nHeight; |
|
|
|
LogPrint("net", "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); |
|
|
|
pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
CheckBlockIndex(); |
|
|
|