LCOV - code coverage report
Current view: top level - src/node - chainstatemanager_args.cpp (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 14 18 77.8 %
Date: 2023-09-26 12:08:55 Functions: 4 4 100.0 %

          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             : #include <node/chainstatemanager_args.h>
       6             : 
       7             : #include <arith_uint256.h>
       8             : #include <common/args.h>
       9             : #include <kernel/chainstatemanager_opts.h>
      10             : #include <node/coins_view_args.h>
      11             : #include <node/database_args.h>
      12             : #include <tinyformat.h>
      13             : #include <uint256.h>
      14             : #include <util/result.h>
      15             : #include <util/strencodings.h>
      16             : #include <util/translation.h>
      17           2 : #include <validation.h>
      18           2 : 
      19             : #include <chrono>
      20             : #include <string>
      21             : 
      22             : namespace node {
      23           1 : util::Result<void> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts)
      24             : {
      25           1 :     if (auto value{args.GetBoolArg("-checkblockindex")}) opts.check_block_index = *value;
      26             : 
      27           1 :     if (auto value{args.GetBoolArg("-checkpoints")}) opts.checkpoints_enabled = *value;
      28             : 
      29           1 :     if (auto value{args.GetArg("-minimumchainwork")}) {
      30           0 :         if (!IsHexNumber(*value)) {
      31           0 :             return util::Error{strprintf(Untranslated("Invalid non-hex (%s) minimum chain work value specified"), *value)};
      32             :         }
      33           0 :         opts.minimum_chain_work = UintToArith256(uint256S(*value));
      34           0 :     }
      35             : 
      36           1 :     if (auto value{args.GetArg("-assumevalid")}) opts.assumed_valid_block = uint256S(*value);
      37             : 
      38           1 :     if (auto value{args.GetIntArg("-maxtipage")}) opts.max_tip_age = std::chrono::seconds{*value};
      39             : 
      40           1 :     ReadDatabaseArgs(args, opts.block_tree_db);
      41           1 :     ReadDatabaseArgs(args, opts.coins_db);
      42           1 :     ReadCoinsViewArgs(args, opts.coins_view);
      43             : 
      44           1 :     return {};
      45           1 : }
      46             : } // namespace node

Generated by: LCOV version 1.14