Bitcoin Core  0.19.99
P2P Digital Currency
walletutil.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2019 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_WALLET_WALLETUTIL_H
6 #define BITCOIN_WALLET_WALLETUTIL_H
7 
8 #include <fs.h>
9 
10 #include <vector>
11 
14 {
15  FEATURE_BASE = 10500, // the earliest version new wallets supports (only useful for getwalletinfo's clientversion output)
16 
17  FEATURE_WALLETCRYPT = 40000, // wallet encryption
18  FEATURE_COMPRPUBKEY = 60000, // compressed public keys
19 
20  FEATURE_HD = 130000, // Hierarchical key derivation after BIP32 (HD Wallet)
21 
22  FEATURE_HD_SPLIT = 139900, // Wallet with HD chain split (change outputs will use m/0'/1'/k)
23 
24  FEATURE_NO_DEFAULT_KEY = 159900, // Wallet without a default key written
25 
26  FEATURE_PRE_SPLIT_KEYPOOL = 169900, // Upgraded to HD SPLIT and can have a pre-split keypool
27 
29 };
30 
31 
32 
33 enum WalletFlags : uint64_t {
34  // wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown
35  // unknown wallet flags in the lower section <= (1 << 31) will be tolerated
36 
37  // will categorize coins as clean (not reused) and dirty (reused), and handle
38  // them with privacy considerations in mind
39  WALLET_FLAG_AVOID_REUSE = (1ULL << 0),
40 
41  // Indicates that the metadata has already been upgraded to contain key origins
43 
44  // will enforce the rule that the wallet can't contain any private keys (only watch-only/pubkeys)
46 
57  WALLET_FLAG_BLANK_WALLET = (1ULL << 33),
58 };
59 
61 fs::path GetWalletDir();
62 
64 std::vector<fs::path> ListWalletDir();
65 
67 class WalletLocation final
68 {
69  std::string m_name;
70  fs::path m_path;
71 
72 public:
73  explicit WalletLocation() {}
74  explicit WalletLocation(const std::string& name);
75 
77  const std::string& GetName() const { return m_name; }
78 
80  const fs::path& GetPath() const { return m_path; }
81 
83  bool Exists() const;
84 };
85 
86 #endif // BITCOIN_WALLET_WALLETUTIL_H
const fs::path & GetPath() const
Get wallet absolute path.
Definition: walletutil.h:80
fs::path GetWalletDir()
Get the path of the wallet directory.
Definition: dummywallet.cpp:60
fs::path m_path
Definition: walletutil.h:70
std::vector< fs::path > ListWalletDir()
Get wallets in wallet directory.
Definition: dummywallet.cpp:65
bool Exists() const
Return whether the wallet exists.
Definition: walletutil.cpp:101
WalletFeature
(client) version numbers for particular wallet features
Definition: walletutil.h:13
std::string m_name
Definition: walletutil.h:69
const std::string & GetName() const
Get wallet name.
Definition: walletutil.h:77
const char * name
Definition: rest.cpp:40
Flag set when a wallet contains no HD seed and no private keys, scripts, addresses, and other watch only things, and is therefore "blank.".
Definition: walletutil.h:57
WalletFlags
Definition: walletutil.h:33
The WalletLocation class provides wallet information.
Definition: walletutil.h:67