Remove checkpoints

The headers presync logic should be enough to prevent memory DoS using
low-work headers. Therefore, we no longer have any use for checkpoints.
This commit is contained in:
marcofleon committed 2025-03-13 11:13:13 +00:00
1 parent 632ae47372
commit 3c5d1a4681
18 files changed
+10 -731

No files matched your search

-15
View File
@@ -38,7 +38,6 @@
#include <cstddef>
#include <map>
#include <ranges>
#include <unordered_map>
namespace kernel {
@@ -576,20 +575,6 @@ void BlockManager::ScanAndUnlinkAlreadyPrunedFiles()
UnlinkPrunedFiles(block_files_to_prune);
}
const CBlockIndex* BlockManager::GetLastCheckpoint(const CCheckpointData& data)
{
const MapCheckpoints& checkpoints = data.mapCheckpoints;
for (const MapCheckpoints::value_type& i : checkpoints | std::views::reverse) {
const uint256& hash = i.second;
const CBlockIndex* pindex = LookupBlockIndex(hash);
if (pindex) {
return pindex;
}
}
return nullptr;
}
bool BlockManager::IsBlockPruned(const CBlockIndex& block) const
{
AssertLockHeld(::cs_main);
-3
View File
@@ -357,9 +357,6 @@ public:
/** Calculate the amount of disk space the block & undo files currently use */
uint64_t CalculateCurrentUsage();
//! Returns last CBlockIndex* that is a checkpoint
const CBlockIndex* GetLastCheckpoint(const CCheckpointData& data) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
//! Check if all blocks in the [upper_block, lower_block] range have data available.
//! The caller is responsible for ensuring that lower_block is an ancestor of upper_block
//! (part of the same chain).
-2
View File
@@ -29,8 +29,6 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& args, ChainstateManage
opts.check_block_index = args.GetArg("-checkblockindex")->empty() ? 1 : *value;
}
if (auto value{args.GetBoolArg("-checkpoints")}) opts.checkpoints_enabled = *value;
if (auto value{args.GetArg("-minimumchainwork")}) {
if (auto min_work{uint256::FromUserHex(*value)}) {
opts.minimum_chain_work = UintToArith256(*min_work);