diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 9e8e0f702..7643ec5df 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -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& mapBlockIndex) { - if (!GetBoolArg("-checkpoints", true)) + if (!fEnabled) return NULL; const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints; diff --git a/src/checkpoints.h b/src/checkpoints.h index 3d5688555..a49a908a3 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -24,6 +24,8 @@ namespace Checkpoints CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex); double GuessVerificationProgress(CBlockIndex *pindex); + + extern bool fEnabled; } #endif diff --git a/src/init.cpp b/src/init.cpp index ebd9dee7b..6dafcc4af 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -10,6 +10,7 @@ #include "init.h" #include "util.h" #include "ui_interface.h" +#include "checkpoints.h" #include #include @@ -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