aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-08-22 04:32:39 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2012-08-22 04:32:39 -0700
commit1a3dcca8f45e78565cb67ff219a7494d1d9d1e26 (patch)
tree5ea12bd9dd0eec5a8dfbeb3e4d5c572f93eac539 /src
parentf39ab4c8d01a14ccc784b122ea133a67b8f75e10 (diff)
parent5c88e3c108f8bbe0edbcd88b3f48e3eaf611cd7c (diff)
downloadbitcoin-1a3dcca8f45e78565cb67ff219a7494d1d9d1e26.tar.xz
Merge pull request #1695 from sipa/noloadorphan
Do not accept orphan blocks in -loadblock mode
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7dd59fdeaa..91aba149bc 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1920,17 +1920,20 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
}
- // If don't already have its previous block, shunt it off to holding area until we get it
+ // If we don't already have its previous block, shunt it off to holding area until we get it
if (!mapBlockIndex.count(pblock->hashPrevBlock))
{
printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", pblock->hashPrevBlock.ToString().substr(0,20).c_str());
- CBlock* pblock2 = new CBlock(*pblock);
- mapOrphanBlocks.insert(make_pair(hash, pblock2));
- mapOrphanBlocksByPrev.insert(make_pair(pblock2->hashPrevBlock, pblock2));
- // Ask this guy to fill in what we're missing
- if (pfrom)
+ // Accept orphans as long as there is a node to request its parents from
+ if (pfrom) {
+ CBlock* pblock2 = new CBlock(*pblock);
+ mapOrphanBlocks.insert(make_pair(hash, pblock2));
+ mapOrphanBlocksByPrev.insert(make_pair(pblock2->hashPrevBlock, pblock2));
+
+ // Ask this guy to fill in what we're missing
pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2));
+ }
return true;
}