Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable the option to disable checkpoints #1309

Merged
merged 5 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,3 +1060,7 @@ void SelectParams(const std::string& network)
SelectBaseParams(network);
globalChainParams = CreateChainParams(network);
}

void ClearCheckpoints(CChainParams &params) {
params.checkpointData = {};
}
2 changes: 2 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class CChainParams
std::vector<MasternodeKeys> vMasternodes;
std::vector<CTransactionRef> CreateGenesisMasternodes();
std::set<CKeyID> genesisTeam;

friend void ClearCheckpoints(CChainParams &params);
};

const auto SMART_CONTRACT_DFIP_2201 = "DFIP2201";
Expand Down
12 changes: 9 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CChainParams&>(chainparams));
} else {
LogPrintf("conf: checkpoints enabled.\n");
}

hashAssumeValid = uint256S(gArgs.GetArg("-assumevalid", chainparams.GetConsensus().defaultAssumeValid.GetHex()));
if (!hashAssumeValid.IsNull())
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down