LCOV - code coverage report
Current view: top level - src/wallet - walletutil.cpp (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 0 21 0.0 %
Date: 2023-11-12 01:39:15 Functions: 0 3 0.0 %
Branches: 0 36 0.0 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2017-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 <wallet/walletutil.h>
       6                 :            : 
       7                 :            : #include <common/args.h>
       8                 :            : #include <logging.h>
       9                 :            : 
      10                 :            : namespace wallet {
      11                 :          0 : fs::path GetWalletDir()
      12                 :            : {
      13                 :          0 :     fs::path path;
      14                 :            : 
      15 [ #  # ][ #  # ]:          0 :     if (gArgs.IsArgSet("-walletdir")) {
                 [ #  # ]
      16 [ #  # ][ #  # ]:          0 :         path = gArgs.GetPathArg("-walletdir");
      17 [ #  # ][ #  # ]:          0 :         if (!fs::is_directory(path)) {
      18                 :            :             // If the path specified doesn't exist, we return the deliberately
      19                 :            :             // invalid empty string.
      20         [ #  # ]:          0 :             path = "";
      21                 :          0 :         }
      22                 :          0 :     } else {
      23 [ #  # ][ #  # ]:          0 :         path = gArgs.GetDataDirNet();
      24                 :            :         // If a wallets directory exists, use that, otherwise default to GetDataDir
      25 [ #  # ][ #  # ]:          0 :         if (fs::is_directory(path / "wallets")) {
         [ #  # ][ #  # ]
      26         [ #  # ]:          0 :             path /= "wallets";
      27                 :          0 :         }
      28                 :            :     }
      29                 :            : 
      30                 :          0 :     return path;
      31         [ #  # ]:          0 : }
      32                 :            : 
      33                 :          0 : bool IsFeatureSupported(int wallet_version, int feature_version)
      34                 :            : {
      35                 :          0 :     return wallet_version >= feature_version;
      36                 :            : }
      37                 :            : 
      38                 :          0 : WalletFeature GetClosestWalletFeature(int version)
      39                 :            : {
      40                 :            :     static constexpr std::array wallet_features{FEATURE_LATEST, FEATURE_PRE_SPLIT_KEYPOOL, FEATURE_NO_DEFAULT_KEY, FEATURE_HD_SPLIT, FEATURE_HD, FEATURE_COMPRPUBKEY, FEATURE_WALLETCRYPT, FEATURE_BASE};
      41         [ #  # ]:          0 :     for (const WalletFeature& wf : wallet_features) {
      42         [ #  # ]:          0 :         if (version >= wf) return wf;
      43                 :            :     }
      44                 :          0 :     return static_cast<WalletFeature>(0);
      45                 :          0 : }
      46                 :            : } // namespace wallet

Generated by: LCOV version 1.14