Bitcoin ABC
0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
src
node
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
5
#include <
node/validation_cache_args.h
>
6
7
#include <
kernel/validation_cache_sizes.h
>
8
9
#include <
common/args.h
>
10
11
#include <algorithm>
12
#include <cstddef>
13
#include <cstdint>
14
#include <memory>
15
#include <optional>
16
17
using
kernel::ValidationCacheSizes
;
18
19
namespace
node
{
20
void
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"
)) {
30
cache_sizes
.script_execution_cache_bytes =
31
std::max<int64_t>(*max_size, 0) * (1 << 20);
32
}
33
}
34
}
// namespace node
args.h
ArgsManager
Definition
args.h:96
ApplyArgsManOptions
std::optional< bilingual_str > ApplyArgsManOptions(const ArgsManager &argsman, const CChainParams &chainparams, MemPoolOptions &mempool_opts)
Overlay the options set in argsman on top of corresponding members in mempool_opts.
Definition
mempool_args.cpp:24
node
Definition
init.h:28
GetRand
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
Definition
random.h:85
kernel::ValidationCacheSizes
Definition
validation_cache_sizes.h:15
validation_cache_args.h
validation_cache_sizes.h
Generated on Sun Oct 13 2024 02:39:35 for Bitcoin ABC by
1.9.8