mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Replace repeated GetBoolArg() calls with Checkpoint::fEnabled variable
set once at init time.
This commit is contained in:
parent
36dc41f427
commit
f0d8a52cc0
@ -28,6 +28,8 @@ namespace Checkpoints
|
|||||||
double fTransactionsPerDay;
|
double fTransactionsPerDay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool fEnabled = true;
|
||||||
|
|
||||||
// What makes a good checkpoint block?
|
// What makes a good checkpoint block?
|
||||||
// + Is surrounded by blocks with reasonable timestamps
|
// + Is surrounded by blocks with reasonable timestamps
|
||||||
// (no blocks before with a timestamp after, none after with
|
// (no blocks before with a timestamp after, none after with
|
||||||
@ -74,7 +76,7 @@ namespace Checkpoints
|
|||||||
|
|
||||||
bool CheckBlock(int nHeight, const uint256& hash)
|
bool CheckBlock(int nHeight, const uint256& hash)
|
||||||
{
|
{
|
||||||
if (!GetBoolArg("-checkpoints", true))
|
if (!fEnabled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
|
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
|
||||||
@ -117,7 +119,7 @@ namespace Checkpoints
|
|||||||
|
|
||||||
int GetTotalBlocksEstimate()
|
int GetTotalBlocksEstimate()
|
||||||
{
|
{
|
||||||
if (!GetBoolArg("-checkpoints", true))
|
if (!fEnabled)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
|
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
|
||||||
@ -127,7 +129,7 @@ namespace Checkpoints
|
|||||||
|
|
||||||
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
|
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
|
||||||
{
|
{
|
||||||
if (!GetBoolArg("-checkpoints", true))
|
if (!fEnabled)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
|
const MapCheckpoints& checkpoints = *Checkpoints().mapCheckpoints;
|
||||||
|
@ -24,6 +24,8 @@ namespace Checkpoints
|
|||||||
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
|
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
|
||||||
|
|
||||||
double GuessVerificationProgress(CBlockIndex *pindex);
|
double GuessVerificationProgress(CBlockIndex *pindex);
|
||||||
|
|
||||||
|
extern bool fEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
|
#include "checkpoints.h"
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
@ -493,6 +494,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
// ********************************************************* Step 2: parameter interactions
|
// ********************************************************* Step 2: parameter interactions
|
||||||
|
|
||||||
fTestNet = GetBoolArg("-testnet");
|
fTestNet = GetBoolArg("-testnet");
|
||||||
|
Checkpoints::fEnabled = GetBoolArg("-checkpoints", true);
|
||||||
|
|
||||||
if (mapArgs.count("-bind")) {
|
if (mapArgs.count("-bind")) {
|
||||||
// when specifying an explicit binding address, you want to listen on it
|
// when specifying an explicit binding address, you want to listen on it
|
||||||
|
Loading…
Reference in New Issue
Block a user