Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
blockmanager_args.cpp
Go to the documentation of this file.
1// Copyright (c) 2023-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
6
7#include <common/args.h>
8#include <node/blockstorage.h>
10#include <tinyformat.h>
11#include <util/result.h>
12#include <util/translation.h>
13#include <validation.h>
14
15#include <cstdint>
16
17namespace node {
19{
20 if (auto value{args.GetBoolArg("-blocksxor")}) opts.use_xor = *value;
21 // block pruning; get the amount of disk space (in MiB) to allot for block & undo files
23 if (nPruneArg < 0) {
24 return util::Error{_("Prune cannot be configured with a negative value.")};
25 }
27 if (nPruneArg == 1) { // manual pruning: -prune=1
29 } else if (nPruneTarget) {
31 return util::Error{strprintf(_("Prune configured below the minimum of %d MiB. Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024)};
32 }
33 }
35
36 if (auto value{args.GetBoolArg("-fastprune")}) opts.fast_prune = *value;
37
39
40 return {};
41}
42} // namespace node
ArgsManager & args
Definition bitcoind.cpp:277
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Definition args.h:306
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition args.cpp:515
static constexpr auto PRUNE_TARGET_MANUAL
util::Result< void > ApplyArgsManOptions(const ArgsManager &args, BlockManager::Options &opts)
void ReadDatabaseArgs(const ArgsManager &args, DBOptions &options)
DBOptions options
Passed-through options.
Definition dbwrapper.h:46
An options struct for BlockManager, more ergonomically referred to as BlockManager::Options due to th...
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
consteval auto _(util::TranslatedLiteral str)
Definition translation.h:79
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:73
static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES
Definition validation.h:87