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