diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 05b8575db36..f38480304ea 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -1060,3 +1060,7 @@ void SelectParams(const std::string& network) SelectBaseParams(network); globalChainParams = CreateChainParams(network); } + +void ClearCheckpoints(CChainParams ¶ms) { + params.checkpointData = {}; +} diff --git a/src/chainparams.h b/src/chainparams.h index fbacc18b6f6..77f0cecdee1 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -121,6 +121,8 @@ class CChainParams std::vector vMasternodes; std::vector CreateGenesisMasternodes(); std::set genesisTeam; + + friend void ClearCheckpoints(CChainParams ¶ms); }; const auto SMART_CONTRACT_DFIP_2201 = "DFIP2201"; diff --git a/src/init.cpp b/src/init.cpp index 65e3d1bae15..bf48fabc157 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1085,8 +1085,14 @@ bool AppInitParameterInteraction() mempool.setSanityCheck(1.0 / ratio); } fCheckBlockIndex = gArgs.GetBoolArg("-checkblockindex", chainparams.DefaultConsistencyChecks()); - if (gArgs.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED)) - LogPrintf("Warning: -checkpoints does nothing, it will be removed in next release.\n"); + if (!gArgs.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED)) { + LogPrintf("conf: checkpoints disabled.\n"); + // Safe to const_cast, as we know it's always allocated, and is always in the global var + // and it is not used anywhere yet. + ClearCheckpoints(const_cast(chainparams)); + } else { + LogPrintf("conf: checkpoints enabled.\n"); + } hashAssumeValid = uint256S(gArgs.GetArg("-assumevalid", chainparams.GetConsensus().defaultAssumeValid.GetHex())); if (!hashAssumeValid.IsNull()) @@ -1360,7 +1366,7 @@ bool AppInitMain(InitInterfaces& interfaces) // Warn about relative -datadir path. if (gArgs.IsArgSet("-datadir") && !fs::path(gArgs.GetArg("-datadir", "")).is_absolute()) { LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */ - "current working directory '%s'. This is fragile, because if defi is started in the future " + "current working directory '%s'. This is fragile, because if defid is started in the future " "from a different location, it will be unable to locate the current data files. There could " "also be data loss if defi is started while in a temporary directory.\n", gArgs.GetArg("-datadir", ""), fs::current_path().string()); diff --git a/src/validation.h b/src/validation.h index 43f0eb7ce93..10b579fd783 100644 --- a/src/validation.h +++ b/src/validation.h @@ -121,7 +121,7 @@ static const int64_t DEFAULT_MAX_TIP_AGE = 10 * 60 * 60; /** Maximum age of our tip in seconds for us to be considered current for fee estimation */ static const int64_t MAX_FEE_ESTIMATION_TIP_AGE = 10 * 60; -static const bool DEFAULT_CHECKPOINTS_ENABLED = false; +static const bool DEFAULT_CHECKPOINTS_ENABLED = true; static const bool DEFAULT_TXINDEX = false; static const char* const DEFAULT_BLOCKFILTERINDEX = "0"; static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100; @@ -160,7 +160,6 @@ extern std::atomic_bool fReindex; extern int nScriptCheckThreads; extern bool fRequireStandard; extern bool fCheckBlockIndex; -extern bool fCheckpointsEnabled; extern bool fStopOrInterrupt; extern std::string fInterruptBlockHash;