aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/net_processing.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 2c91b5cf0f..cdc7e90316 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1406,9 +1406,11 @@ void PeerManagerImpl::FindNextBlocksToDownload(const Peer& peer, unsigned int co
return;
}
- if (state->pindexLastCommonBlock == nullptr) {
- // Bootstrap quickly by guessing a parent of our best tip is the forking point.
- // Guessing wrong in either direction is not a problem.
+ // Bootstrap quickly by guessing a parent of our best tip is the forking point.
+ // Guessing wrong in either direction is not a problem.
+ // Also reset pindexLastCommonBlock after a snapshot was loaded, so that blocks after the snapshot will be prioritised for download.
+ if (state->pindexLastCommonBlock == nullptr ||
+ (snap_base && state->pindexLastCommonBlock->nHeight < snap_base->nHeight)) {
state->pindexLastCommonBlock = m_chainman.ActiveChain()[std::min(state->pindexBestKnownBlock->nHeight, m_chainman.ActiveChain().Height())];
}