From 22743b2fba89b3bbc21cfe65bf1902b7641baf36 Mon Sep 17 00:00:00 2001 From: "James C. Owens" Date: Sun, 7 Jul 2024 14:58:14 -0400 Subject: [PATCH] Support -clearallregistryhistory startup parameter This allows specifying -clearallregistryhistory as a startup parameter to clear all of the contract registries. --- src/gridcoin/gridcoin.cpp | 2 +- src/init.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gridcoin/gridcoin.cpp b/src/gridcoin/gridcoin.cpp index 693eb318fd..ac839721cf 100644 --- a/src/gridcoin/gridcoin.cpp +++ b/src/gridcoin/gridcoin.cpp @@ -170,7 +170,7 @@ void InitializeContracts(CBlockIndex* pindexBest) uiInterface.InitMessage(_("Loading history for contract type ") + tr_contract_type_string + "..."); std::string history_arg = "-clear" + GRC::Contract::Type::ToString(contract_type) + "history"; - if (gArgs.GetBoolArg(history_arg, false)) { + if (gArgs.GetBoolArg(history_arg, false) || gArgs.GetBoolArg("-clearallregistryhistory", false)) { registry.Reset(); } diff --git a/src/init.cpp b/src/init.cpp index 5cb0bff00c..dcbdd4de00 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -627,13 +627,17 @@ void SetupServerArgs() hidden_args.emplace_back("-activebeforesb"); // This puts hidden options in the form of -clearhistory, where is the contract types that have a - // registry with a backing db. This is currently beacon, project, protocol, and scraper. + // registry with a backing db. This is currently beacon, project, protocol, and scraper, with sidestakes starting + // at V13 height. for (const auto& contract_type : GRC::RegistryBookmarks::CONTRACT_TYPES_WITH_REG_DB) { std::string history_arg = "-clear" + GRC::Contract::Type::ToString(contract_type) + "history"; hidden_args.emplace_back(history_arg); } + // Also allow the -clearallregistryhistory hidden argument to support clearing all of the registries. + hidden_args.emplace_back("-clearallregistryhistory"); + // -boinckey should now be removed entirely. It is put here to prevent the executable erroring out on // an invalid parameter for old clients that may have left the argument in. hidden_args.emplace_back("-boinckey");