mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Move ::fCheckpointsEnabled into ChainstateManager
This commit is contained in:
parent
cccca83099
commit
fa43188d86
5 changed files with 5 additions and 5 deletions
|
@ -935,7 +935,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
|
|||
init::SetLoggingLevel(args);
|
||||
|
||||
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
|
||||
int64_t nPruneArg = args.GetIntArg("-prune", 0);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
class CChainParams;
|
||||
|
||||
static constexpr bool DEFAULT_CHECKPOINTS_ENABLED{true};
|
||||
static constexpr auto DEFAULT_MAX_TIP_AGE{24h};
|
||||
|
||||
namespace kernel {
|
||||
|
@ -27,6 +28,7 @@ namespace kernel {
|
|||
struct ChainstateManagerOpts {
|
||||
const CChainParams& chainparams;
|
||||
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.
|
||||
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.
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
namespace node {
|
||||
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 (!IsHexNumber(*value)) {
|
||||
return strprintf(Untranslated("Invalid non-hex (%s) minimum chain work value specified"), *value);
|
||||
|
|
|
@ -122,7 +122,6 @@ std::condition_variable g_best_block_cv;
|
|||
uint256 g_best_block;
|
||||
bool g_parallel_script_checks{false};
|
||||
bool fCheckBlockIndex = false;
|
||||
bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
|
||||
|
||||
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");
|
||||
|
||||
// Check against checkpoints
|
||||
if (fCheckpointsEnabled) {
|
||||
if (chainman.m_options.checkpoints_enabled) {
|
||||
// Don't accept any forks from the main chain prior to last checkpoint.
|
||||
// GetLastCheckpoint finds the last checkpoint in MapCheckpoints that's in our
|
||||
// BlockIndex().
|
||||
|
|
|
@ -63,7 +63,6 @@ struct Params;
|
|||
static const int MAX_SCRIPTCHECK_THREADS = 15;
|
||||
/** -par default (number of script-checking threads, 0 = auto) */
|
||||
static const int DEFAULT_SCRIPTCHECK_THREADS = 0;
|
||||
static const bool DEFAULT_CHECKPOINTS_ENABLED = true;
|
||||
/** Default for -stopatheight */
|
||||
static const int DEFAULT_STOPATHEIGHT = 0;
|
||||
/** 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 fCheckBlockIndex;
|
||||
extern bool fCheckpointsEnabled;
|
||||
|
||||
/** Documentation for argument 'checklevel'. */
|
||||
extern const std::vector<std::string> CHECKLEVEL_DOC;
|
||||
|
|
Loading…
Add table
Reference in a new issue