aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2011-12-25 09:26:12 -0500
committerLuke Dashjr <luke-jr+git@utopios.org>2011-12-25 09:26:12 -0500
commit3b8051864b98eb5a9df6327f314a45af9205a09c (patch)
tree8052737a591599ea73f20552556ab52f49f522e2
parent863238316144b0ae8d0208ed60d86d932475cfaa (diff)
Be more conservative: check all transactions in blocks after last checkpoint.
-rw-r--r--src/main.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f21af90473..1f23844573 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,7 +30,6 @@ map<COutPoint, CInPoint> mapNextTx;
map<uint256, CBlockIndex*> mapBlockIndex;
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f");
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 32);
-const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download"
CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1;
CBigNum bnBestChainWork = 0;
@@ -750,7 +749,7 @@ int GetNumBlocksOfPeers()
bool IsInitialBlockDownload()
{
- if (pindexBest == NULL || nBestHeight < (Checkpoints::GetTotalBlocksEstimate()-nInitialBlockThreshold))
+ if (pindexBest == NULL || nBestHeight < Checkpoints::GetTotalBlocksEstimate())
return true;
static int64 nLastUpdate;
static CBlockIndex* pindexLastBest;
@@ -881,10 +880,10 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, map<uint256, CTxIndex>& mapTestPoo
if (pindex->nBlockPos == txindex.pos.nBlockPos && pindex->nFile == txindex.pos.nFile)
return error("ConnectInputs() : tried to spend coinbase at depth %d", pindexBlock->nHeight - pindex->nHeight);
- // Skip ECDSA signature verification when connecting blocks (fBlock=true) during initial download
- // (before the last blockchain checkpoint). This is safe because block merkle hashes are
+ // Skip ECDSA signature verification when connecting blocks (fBlock=true)
+ // before the last blockchain checkpoint. This is safe because block merkle hashes are
// still computed and checked, and any change will be caught at the next checkpoint.
- if (!(fBlock && IsInitialBlockDownload()))
+ if (!(fBlock && (nBestHeight < Checkpoints::GetTotalBlocksEstimate())))
// Verify signature
if (!VerifySignature(txPrev, *this, i))
return DoS(100,error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str()));