mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-27 03:33:27 -03:00
Merge pull request #6233
3e91433
Advance pindexLastCommonBlock for blocks in chainActive (Suhas Daftuar)
This commit is contained in:
commit
e34a8acd9f
1 changed files with 3 additions and 2 deletions
|
@ -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
|
// 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
|
// 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) {
|
BOOST_FOREACH(CBlockIndex* pindex, vToFetch) {
|
||||||
if (!pindex->IsValid(BLOCK_VALID_TREE)) {
|
if (!pindex->IsValid(BLOCK_VALID_TREE)) {
|
||||||
// We consider the chain that this peer is on invalid.
|
// We consider the chain that this peer is on invalid.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pindex->nStatus & BLOCK_HAVE_DATA) {
|
if (pindex->nStatus & BLOCK_HAVE_DATA || chainActive.Contains(pindex)) {
|
||||||
if (pindex->nChainTx)
|
if (pindex->nChainTx)
|
||||||
state->pindexLastCommonBlock = pindex;
|
state->pindexLastCommonBlock = pindex;
|
||||||
} else if (mapBlocksInFlight.count(pindex->GetBlockHash()) == 0) {
|
} else if (mapBlocksInFlight.count(pindex->GetBlockHash()) == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue