diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-04-28 10:12:53 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-04-28 10:17:04 +0200 |
| commit | 5048465fc5ed2236f513edbe95cd74f9c71f7c76 (patch) | |
| tree | 1da1a19868635509d62092814c696ea5b0bd4106 /src/main.cpp | |
| parent | Merge pull request #5199 (diff) | |
| parent | Change download logic to allow calling getheaders/getdata on inbound peers (diff) | |
| download | discoin-5048465fc5ed2236f513edbe95cd74f9c71f7c76.tar.xz discoin-5048465fc5ed2236f513edbe95cd74f9c71f7c76.zip | |
Merge pull request #5662
00dcaf4 Change download logic to allow calling getheaders/getdata on inbound peers (Suhas Daftuar)
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index bf32ac91e..2c12e0849 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4839,9 +4839,9 @@ bool SendMessages(CNode* pto, bool fSendTrickle) if (pindexBestHeader == NULL) 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. - if (!state.fSyncStarted && !pto->fClient && fFetch && !fImporting && !fReindex) { + if (!state.fSyncStarted && !pto->fClient && !fImporting && !fReindex) { // Only actively request headers from a single peer, unless we're close to today. - if (nSyncStarted == 0 || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { + if ((nSyncStarted == 0 && fFetch) || pindexBestHeader->GetBlockTime() > GetAdjustedTime() - 24 * 60 * 60) { state.fSyncStarted = true; nSyncStarted++; CBlockIndex *pindexStart = pindexBestHeader->pprev ? pindexBestHeader->pprev : pindexBestHeader; @@ -4929,7 +4929,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) // Message: getdata (blocks) // vector<CInv> vGetData; - if (!pto->fDisconnect && !pto->fClient && fFetch && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { + if (!pto->fDisconnect && !pto->fClient && (fFetch || !IsInitialBlockDownload()) && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { vector<CBlockIndex*> vToDownload; NodeId staller = -1; FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state.nBlocksInFlight, vToDownload, staller); |