Move ::fCheckpointsEnabled into ChainstateManager
This commit is contained in:
5 files changed
+5
-5
No files matched your search
@@ -935,7 +935,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
|
|||||||
init::SetLoggingLevel(args);
|
init::SetLoggingLevel(args);
|
||||||
|
|
||||||
fCheckBlockIndex = args.GetBoolArg("-checkblockindex", chainparams.DefaultConsistencyChecks());
|
fCheckBlockIndex = args.GetBoolArg("-checkblockindex", chainparams.DefaultConsistencyChecks());
|
||||||
fCheckpointsEnabled = args.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED);
|
|
||||||
|
|
||||||
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
|
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
|
||||||
int64_t nPruneArg = args.GetIntArg("-prune", 0);
|
int64_t nPruneArg = args.GetIntArg("-prune", 0);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
class CChainParams;
|
class CChainParams;
|
||||||
|
|
||||||
|
static constexpr bool DEFAULT_CHECKPOINTS_ENABLED{true};
|
||||||
static constexpr auto DEFAULT_MAX_TIP_AGE{24h};
|
static constexpr auto DEFAULT_MAX_TIP_AGE{24h};
|
||||||
|
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
@@ -27,6 +28,7 @@ namespace kernel {
|
|||||||
struct ChainstateManagerOpts {
|
struct ChainstateManagerOpts {
|
||||||
const CChainParams& chainparams;
|
const CChainParams& chainparams;
|
||||||
const std::function<NodeClock::time_point()> adjusted_time_callback{nullptr};
|
const std::function<NodeClock::time_point()> adjusted_time_callback{nullptr};
|
||||||
|
bool checkpoints_enabled{DEFAULT_CHECKPOINTS_ENABLED};
|
||||||
//! If set, it will override the minimum work we will assume exists on some valid chain.
|
//! If set, it will override the minimum work we will assume exists on some valid chain.
|
||||||
std::optional<arith_uint256> minimum_chain_work;
|
std::optional<arith_uint256> minimum_chain_work;
|
||||||
//! If set, it will override the block hash whose ancestors we will assume to have valid scripts without checking them.
|
//! If set, it will override the block hash whose ancestors we will assume to have valid scripts without checking them.
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
namespace node {
|
namespace node {
|
||||||
std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts)
|
std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts)
|
||||||
{
|
{
|
||||||
|
if (auto value{args.GetBoolArg("-checkpoints")}) opts.checkpoints_enabled = *value;
|
||||||
|
|
||||||
if (auto value{args.GetArg("-minimumchainwork")}) {
|
if (auto value{args.GetArg("-minimumchainwork")}) {
|
||||||
if (!IsHexNumber(*value)) {
|
if (!IsHexNumber(*value)) {
|
||||||
return strprintf(Untranslated("Invalid non-hex (%s) minimum chain work value specified"), *value);
|
return strprintf(Untranslated("Invalid non-hex (%s) minimum chain work value specified"), *value);
|
||||||
|
|||||||
+1
-2
@@ -122,7 +122,6 @@ std::condition_variable g_best_block_cv;
|
|||||||
uint256 g_best_block;
|
uint256 g_best_block;
|
||||||
bool g_parallel_script_checks{false};
|
bool g_parallel_script_checks{false};
|
||||||
bool fCheckBlockIndex = false;
|
bool fCheckBlockIndex = false;
|
||||||
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
|
|
||||||
|
|
||||||
const CBlockIndex* Chainstate::FindForkInGlobalIndex(const CBlockLocator& locator) const
|
const CBlockIndex* Chainstate::FindForkInGlobalIndex(const CBlockLocator& locator) const
|
||||||
{
|
{
|
||||||
@@ -3528,7 +3527,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio
|
|||||||
return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "bad-diffbits", "incorrect proof of work");
|
return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "bad-diffbits", "incorrect proof of work");
|
||||||
|
|
||||||
// Check against checkpoints
|
// Check against checkpoints
|
||||||
if (fCheckpointsEnabled) {
|
if (chainman.m_options.checkpoints_enabled) {
|
||||||
// Don't accept any forks from the main chain prior to last checkpoint.
|
// Don't accept any forks from the main chain prior to last checkpoint.
|
||||||
// GetLastCheckpoint finds the last checkpoint in MapCheckpoints that's in our
|
// GetLastCheckpoint finds the last checkpoint in MapCheckpoints that's in our
|
||||||
// BlockIndex().
|
// BlockIndex().
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ struct Params;
|
|||||||
static const int MAX_SCRIPTCHECK_THREADS = 15;
|
static const int MAX_SCRIPTCHECK_THREADS = 15;
|
||||||
/** -par default (number of script-checking threads, 0 = auto) */
|
/** -par default (number of script-checking threads, 0 = auto) */
|
||||||
static const int DEFAULT_SCRIPTCHECK_THREADS = 0;
|
static const int DEFAULT_SCRIPTCHECK_THREADS = 0;
|
||||||
static const bool DEFAULT_CHECKPOINTS_ENABLED = true;
|
|
||||||
/** Default for -stopatheight */
|
/** Default for -stopatheight */
|
||||||
static const int DEFAULT_STOPATHEIGHT = 0;
|
static const int DEFAULT_STOPATHEIGHT = 0;
|
||||||
/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned. */
|
/** Block files containing a block-height within MIN_BLOCKS_TO_KEEP of ActiveChain().Tip() will not be pruned. */
|
||||||
@@ -97,7 +96,6 @@ extern uint256 g_best_block;
|
|||||||
*/
|
*/
|
||||||
extern bool g_parallel_script_checks;
|
extern bool g_parallel_script_checks;
|
||||||
extern bool fCheckBlockIndex;
|
extern bool fCheckBlockIndex;
|
||||||
extern bool fCheckpointsEnabled;
|
|
||||||
|
|
||||||
/** Documentation for argument 'checklevel'. */
|
/** Documentation for argument 'checklevel'. */
|
||||||
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
||||||
|
|||||||
Reference in new issue
Block a user