Bitcoin ABC 0.30.5
P2P Digital Currency
validation_cache_args.cpp
Go to the documentation of this file.
1// Copyright (c) 2022 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
8
9#include <common/args.h>
10
11#include <algorithm>
12#include <cstddef>
13#include <cstdint>
14#include <memory>
15#include <optional>
16
18
19namespace node {
20void ApplyArgsManOptions(const ArgsManager &argsman,
21 ValidationCacheSizes &cache_sizes) {
22 // When supplied with a max_size of 0, both InitSignatureCache and
23 // InitScriptExecutionCache create the minimum possible cache (2
24 // elements). Therefore, we can use 0 as a floor here.
25 if (auto max_size = argsman.GetIntArg("-maxsigcachesize")) {
26 cache_sizes.signature_cache_bytes =
27 std::max<int64_t>(*max_size, 0) * (1 << 20);
28 }
29 if (auto max_size = argsman.GetIntArg("-maxscriptcachesize")) {
31 std::max<int64_t>(*max_size, 0) * (1 << 20);
32 }
33}
34} // namespace node
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Return integer argument or default value.
Definition: args.cpp:526
Definition: init.h:28
std::optional< bilingual_str > ApplyArgsManOptions(const ArgsManager &args, BlockManager::Options &opts)