Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2023-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <node/blockmanager_args.h>7#include <common/args.h>8#include <node/blockstorage.h>9#include <node/database_args.h>10#include <tinyformat.h>11#include <util/byte_units.h>12#include <util/result.h>13#include <util/translation.h>14#include <validation.h>16#include <cstdint>18namespace node {19util::Result<void> ApplyArgsManOptions(const ArgsManager& args, BlockManager::Options& opts)20{21if (auto value{args.GetBoolArg("-blocksxor")}) opts.use_xor = *value;22// block pruning; get the amount of disk space (in MiB) to allot for block & undo files23int64_t nPruneArg{args.GetIntArg("-prune", opts.prune_target)};24if (nPruneArg < 0) {25return util::Error{_("Prune cannot be configured with a negative value.")};26}27uint64_t nPruneTarget{uint64_t(nPruneArg) * 1_MiB};28if (nPruneArg == 1) { // manual pruning: -prune=129nPruneTarget = BlockManager::PRUNE_TARGET_MANUAL;30} else if (nPruneTarget) {31if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {32return util::Error{strprintf(_("Prune configured below the minimum of %d MiB. Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1_MiB)};33}34}35opts.prune_target = nPruneTarget;37if (auto value{args.GetBoolArg("-fastprune")}) opts.fast_prune = *value;39ReadDatabaseArgs(args, opts.block_tree_db_params.options);41return {};42}43} // namespace node