This commit is contained in:
jl777
2018-07-05 04:20:21 -11:00
parent 3df89af7fe
commit 18c515eb03

View File

@@ -6827,15 +6827,15 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
pindexBestHeader = chainActive.Tip();
bool fFetch = state.fPreferredDownload || (nPreferredDownload == 0 && !pto->fClient && !pto->fOneShot); // Download if this is a nice peer, or we have no nice peers and this one might do.
//fprintf(stderr,"see if can request\n");
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex)
if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex && pto->nStartingHeight != 0 )
{
// Only actively request headers from a single peer, unless we're close to today.
if ((nSyncStarted < 30 && fFetch) )//|| pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60)
if ( (nSyncStarted < 30 && (fFetch || pindexStart->nHeight == 0) )//|| pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60)
{
state.fSyncStarted = true;
nSyncStarted++;
CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader;
fprintf(stderr,"ask initial headers: nSyncStarted.%d fFetch.%d peer.%d [%d to %d]\n",(int32_t)nSyncStarted,(int32_t)fFetch,pto->id, pto->nStartingHeight,pindexStart->nHeight);
fprintf(stderr,"ask initial headers: nSyncStarted.%d fFetch.%d peer.%d [%d to %d]\n",(int32_t)nSyncStarted,(int32_t)fFetch,pto->id, pindexStart->nHeight,pto->nStartingHeight);
LogPrint("net", "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->id, pto->nStartingHeight);
pto->PushMessage("getheaders", chainActive.GetLocator(pindexStart), uint256());
}