aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-06-25 16:29:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-25 16:36:23 +0200
commite34a8acd9f80bd841215471ece7097f664b8028b (patch)
tree9fc414723effffcbff3532eeb86022b3e26d551f /src
parentc3f0490a0687c7d2d5c45a8f448ebdc640629a1b (diff)
parent3e9143386a90e508c8d41719294db11264f5f0a0 (diff)
Merge pull request #6233
3e91433 Advance pindexLastCommonBlock for blocks in chainActive (Suhas Daftuar)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0be54ebd41..a3e43e0cc5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -434,13 +434,14 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<CBl
// Iterate over those blocks in vToFetch (in forward direction), adding the ones that
// are not yet downloaded and not in flight to vBlocks. In the mean time, update
- // pindexLastCommonBlock as long as all ancestors are already downloaded.
+ // pindexLastCommonBlock as long as all ancestors are already downloaded, or if it's
+ // already part of our chain (and therefore don't need it even if pruned).
BOOST_FOREACH(CBlockIndex* pindex, vToFetch) {
if (!pindex->IsValid(BLOCK_VALID_TREE)) {
// We consider the chain that this peer is on invalid.
return;
}
- if (pindex->nStatus & BLOCK_HAVE_DATA) {
+ if (pindex->nStatus & BLOCK_HAVE_DATA || chainActive.Contains(pindex)) {
if (pindex->nChainTx)
state->pindexLastCommonBlock = pindex;
} else if (mapBlocksInFlight.count(pindex->GetBlockHash()) == 0) {