PPCoin: Modify checkpoint policy to always protect 6 block-confirmations
authorScott Nadal <scott.nadal@gmail.com>
Sun, 16 Sep 2012 23:48:46 +0000 (00:48 +0100)
committerScott Nadal <scott.nadal@gmail.com>
Sun, 16 Sep 2012 23:48:46 +0000 (00:48 +0100)
src/checkpoints.cpp

index 94e5c23..96db32e 100644 (file)
@@ -195,7 +195,7 @@ namespace Checkpoints
         // Select the last proof-of-work block
         const CBlockIndex *pindex = GetLastBlockIndex(pindexBest, false);
         // Search forward for a block within max span and maturity window
-        while (pindex->pnext && (pindex->GetBlockTime() + CHECKPOINT_MAX_SPAN <= pindexBest->GetBlockTime() || pindex->nHeight + nCoinbaseMaturity - 20 <= pindexBest->nHeight))
+        while (pindex->pnext && (pindex->GetBlockTime() + CHECKPOINT_MAX_SPAN <= pindexBest->GetBlockTime() || pindex->nHeight + std::min(6, nCoinbaseMaturity - 20) <= pindexBest->nHeight))
             pindex = pindex->pnext;
         return pindex->GetBlockHash();
     }