Add "checkpoints" option, to permit disabling of checkpoint logic.

This commit is contained in:
Jeff Garzik
2012-11-28 12:07:42 -05:00
committed by Jeff Garzik
parent 0c50d8b007
commit 857b3ad923
2 changed files with 10 additions and 0 deletions

View File

@@ -39,6 +39,9 @@ namespace Checkpoints
bool CheckBlock(int nHeight, const uint256& hash)
{
if (!GetBoolArg("-checkpoints", false))
return true;
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
@@ -48,6 +51,9 @@ namespace Checkpoints
int GetTotalBlocksEstimate()
{
if (!GetBoolArg("-checkpoints", false))
return 0;
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
return checkpoints.rbegin()->first;
@@ -55,6 +61,9 @@ namespace Checkpoints
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
if (!GetBoolArg("-checkpoints", false))
return NULL;
MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)