]> Git Repo - VerusCoin.git/blobdiff - src/checkpoints.cpp
fix GetScriptForMining() CReserveKey::keepKey() issue
[VerusCoin.git] / src / checkpoints.cpp
index 71579bb309e727408fe56f008b40bc5605e6a6fd..87f4ad7f2ec6a079a432d5cc168d0fd04816799e 100644 (file)
 namespace Checkpoints {
 
     /**
-     * How many times we expect transactions after the last checkpoint to
-     * be slower. This number is a compromise, as it can't be accurate for
-     * every system. When reindexing from a fast disk with a slow CPU, it
+     * How many times slower we expect checking transactions after the last
+     * checkpoint to be (from checking signatures, which is skipped up to the
+     * last checkpoint). This number is a compromise, as it can't be accurate
+     * for every system. When reindexing from a fast disk with a slow CPU, it
      * can be up to 20, while when downloading from a slow network with a
      * fast multicore CPU, it won't be much higher than 1.
      */
     static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
 
-    bool fEnabled = true;
-
-    bool CheckBlock(int nHeight, const uint256& hash)
-    {
-        if (!fEnabled)
-            return true;
-
-        const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints;
-
-        MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
-        if (i == checkpoints.end()) return true;
-        return hash == i->second;
-    }
-
     //! Guess how far we are in the verification process at the given block index
-    double GuessVerificationProgress(CBlockIndex *pindex, bool fSigchecks) {
+    double GuessVerificationProgress(const CCheckpointData& data, CBlockIndex *pindex, bool fSigchecks) {
         if (pindex==NULL)
             return 0.0;
 
@@ -50,8 +37,6 @@ namespace Checkpoints {
         // Work is defined as: 1.0 per transaction before the last checkpoint, and
         // fSigcheckVerificationFactor per transaction after.
 
-        const CCheckpointData &data = Params().Checkpoints();
-
         if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
             double nCheapBefore = pindex->nChainTx;
             double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
@@ -69,22 +54,19 @@ namespace Checkpoints {
         return fWorkBefore / (fWorkBefore + fWorkAfter);
     }
 
-    int GetTotalBlocksEstimate()
+    int GetTotalBlocksEstimate(const CCheckpointData& data)
     {
-        if (!fEnabled)
-            return 0;
+        const MapCheckpoints& checkpoints = data.mapCheckpoints;
 
-        const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints;
+        if (checkpoints.empty())
+            return 0;
 
         return checkpoints.rbegin()->first;
     }
 
-    CBlockIndex* GetLastCheckpoint()
+    CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
     {
-        if (!fEnabled)
-            return NULL;
-
-        const MapCheckpoints& checkpoints = *Params().Checkpoints().mapCheckpoints;
+        const MapCheckpoints& checkpoints = data.mapCheckpoints;
 
         BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
         {
This page took 0.027015 seconds and 4 git commands to generate.