Use last checkpoint instead of hard-coded 140,700. Fixes #913.
authorGavin Andresen <gavinandresen@gmail.com>
Tue, 20 Mar 2012 17:45:45 +0000 (13:45 -0400)
committerLuke Dashjr <luke-jr+git@utopios.org>
Thu, 22 Mar 2012 20:08:21 +0000 (16:08 -0400)
src/main.cpp

index 759e514..c2decc3 100644 (file)
@@ -1508,10 +1508,11 @@ bool CBlock::AcceptBlock()
         return error("AcceptBlock() : AddToBlockIndex failed");
 
     // Relay inventory, but don't relay old inventory during initial block download
+    int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate();
     if (hashBestChain == hash)
         CRITICAL_BLOCK(cs_vNodes)
             BOOST_FOREACH(CNode* pnode, vNodes)
-                if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 140700))
+                if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
                     pnode->PushInventory(CInv(MSG_BLOCK, hash));
 
     return true;