]> Git Repo - VerusCoin.git/commitdiff
Replace repeated GetBoolArg() calls with Checkpoint::fEnabled variable
authorJeff Garzik <[email protected]>
Fri, 24 May 2013 15:10:53 +0000 (11:10 -0400)
committerJeff Garzik <[email protected]>
Fri, 24 May 2013 15:10:53 +0000 (11:10 -0400)
set once at init time.

src/checkpoints.cpp
src/checkpoints.h
src/init.cpp

index 9e8e0f70242e0f21bd5a4052f9bd880836ec8ac3..7643ec5df88fef9fea83b2d851671c0b2639cdfe 100644 (file)
@@ -28,6 +28,8 @@ namespace Checkpoints
         double fTransactionsPerDay;
     };
 
+    bool fEnabled = true;
+
     // What makes a good checkpoint block?
     // + Is surrounded by blocks with reasonable timestamps
     //   (no blocks before with a timestamp after, none after with
@@ -74,7 +76,7 @@ namespace Checkpoints
 
     bool CheckBlock(int nHeight, const uint256& hash)
     {
-        if (!GetBoolArg("-checkpoints", true))
+        if (!fEnabled)
             return true;
 
         const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
@@ -117,7 +119,7 @@ namespace Checkpoints
 
     int GetTotalBlocksEstimate()
     {
-        if (!GetBoolArg("-checkpoints", true))
+        if (!fEnabled)
             return 0;
 
         const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
@@ -127,7 +129,7 @@ namespace Checkpoints
 
     CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
     {
-        if (!GetBoolArg("-checkpoints", true))
+        if (!fEnabled)
             return NULL;
 
         const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
index 3d56885556c63e4c082898a33f60ee4feee5c8a8..a49a908a386cd4a0cc60a3c4cec24bc932d9f70a 100644 (file)
@@ -24,6 +24,8 @@ namespace Checkpoints
     CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
 
     double GuessVerificationProgress(CBlockIndex *pindex);
+
+    extern bool fEnabled;
 }
 
 #endif
index ebd9dee7b2ffd86e5b1662786c50484982d29193..6dafcc4af0a40282f565e22996777d55721fd7e4 100644 (file)
@@ -10,6 +10,7 @@
 #include "init.h"
 #include "util.h"
 #include "ui_interface.h"
+#include "checkpoints.h"
 
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/fstream.hpp>
@@ -493,6 +494,7 @@ bool AppInit2(boost::thread_group& threadGroup)
     // ********************************************************* Step 2: parameter interactions
 
     fTestNet = GetBoolArg("-testnet");
+    Checkpoints::fEnabled = GetBoolArg("-checkpoints", true);
 
     if (mapArgs.count("-bind")) {
         // when specifying an explicit binding address, you want to listen on it
This page took 0.026741 seconds and 4 git commands to generate.