Branch data Line data Source code
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 : : #ifndef BITCOIN_KERNEL_CHAINSTATEMANAGER_OPTS_H
6 : : #define BITCOIN_KERNEL_CHAINSTATEMANAGER_OPTS_H
7 : :
8 : : #include <kernel/notifications_interface.h>
9 : :
10 : : #include <arith_uint256.h>
11 : : #include <dbwrapper.h>
12 : : #include <script/sigcache.h>
13 : : #include <txdb.h>
14 : : #include <uint256.h>
15 : : #include <util/time.h>
16 : :
17 : : #include <cstdint>
18 : : #include <functional>
19 : : #include <optional>
20 : :
21 : : class CChainParams;
22 : : class ValidationSignals;
23 : :
24 : : static constexpr auto DEFAULT_MAX_TIP_AGE{24h};
25 : :
26 : : namespace kernel {
27 : :
28 : : /**
29 : : * An options struct for `ChainstateManager`, more ergonomically referred to as
30 : : * `ChainstateManager::Options` due to the using-declaration in
31 : : * `ChainstateManager`.
32 : : */
33 [ + - ]: 10258 : struct ChainstateManagerOpts {
34 : : const CChainParams& chainparams;
35 : : fs::path datadir;
36 : : std::optional<int32_t> check_block_index{};
37 : : //! If set, it will override the minimum work we will assume exists on some valid chain.
38 : : std::optional<arith_uint256> minimum_chain_work{};
39 : : //! If set, it will override the block hash whose ancestors we will assume to have valid scripts without checking them.
40 : : std::optional<uint256> assumed_valid_block{};
41 : : //! If the tip is older than this, the node is considered to be in initial block download.
42 : : std::chrono::seconds max_tip_age{DEFAULT_MAX_TIP_AGE};
43 : : DBOptions coins_db{};
44 : : CoinsViewOptions coins_view{};
45 : : Notifications& notifications;
46 : : ValidationSignals* signals{nullptr};
47 : : //! Number of script check worker threads. Zero means no parallel verification.
48 : : int worker_threads_num{0};
49 : : size_t script_execution_cache_bytes{DEFAULT_SCRIPT_EXECUTION_CACHE_BYTES};
50 : : size_t signature_cache_bytes{DEFAULT_SIGNATURE_CACHE_BYTES};
51 : : };
52 : :
53 : : } // namespace kernel
54 : :
55 : : #endif // BITCOIN_KERNEL_CHAINSTATEMANAGER_OPTS_H
|