Skip to content

Commit ab053ec

Browse files
committed
Move wallet enums to walletutil.h
1 parent 25d7e2e commit ab053ec

File tree

2 files changed

+48
-46
lines changed

2 files changed

+48
-46
lines changed

src/wallet/wallet.h

-46
Original file line numberDiff line numberDiff line change
@@ -99,58 +99,12 @@ struct FeeCalculation;
9999
enum class FeeEstimateMode;
100100
class ReserveDestination;
101101

102-
/** (client) version numbers for particular wallet features */
103-
enum WalletFeature
104-
{
105-
FEATURE_BASE = 10500, // the earliest version new wallets supports (only useful for getwalletinfo's clientversion output)
106-
107-
FEATURE_WALLETCRYPT = 40000, // wallet encryption
108-
FEATURE_COMPRPUBKEY = 60000, // compressed public keys
109-
110-
FEATURE_HD = 130000, // Hierarchical key derivation after BIP32 (HD Wallet)
111-
112-
FEATURE_HD_SPLIT = 139900, // Wallet with HD chain split (change outputs will use m/0'/1'/k)
113-
114-
FEATURE_NO_DEFAULT_KEY = 159900, // Wallet without a default key written
115-
116-
FEATURE_PRE_SPLIT_KEYPOOL = 169900, // Upgraded to HD SPLIT and can have a pre-split keypool
117-
118-
FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL
119-
};
120-
121102
//! Default for -addresstype
122103
constexpr OutputType DEFAULT_ADDRESS_TYPE{OutputType::BECH32};
123104

124105
//! Default for -changetype
125106
constexpr OutputType DEFAULT_CHANGE_TYPE{OutputType::CHANGE_AUTO};
126107

127-
enum WalletFlags : uint64_t {
128-
// wallet flags in the upper section (> 1 << 31) will lead to not opening the wallet if flag is unknown
129-
// unknown wallet flags in the lower section <= (1 << 31) will be tolerated
130-
131-
// will categorize coins as clean (not reused) and dirty (reused), and handle
132-
// them with privacy considerations in mind
133-
WALLET_FLAG_AVOID_REUSE = (1ULL << 0),
134-
135-
// Indicates that the metadata has already been upgraded to contain key origins
136-
WALLET_FLAG_KEY_ORIGIN_METADATA = (1ULL << 1),
137-
138-
// will enforce the rule that the wallet can't contain any private keys (only watch-only/pubkeys)
139-
WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32),
140-
141-
//! Flag set when a wallet contains no HD seed and no private keys, scripts,
142-
//! addresses, and other watch only things, and is therefore "blank."
143-
//!
144-
//! The only function this flag serves is to distinguish a blank wallet from
145-
//! a newly created wallet when the wallet database is loaded, to avoid
146-
//! initialization that should only happen on first run.
147-
//!
148-
//! This flag is also a mandatory flag to prevent previous versions of
149-
//! bitcoin from opening the wallet, thinking it was newly created, and
150-
//! then improperly reinitializing it.
151-
WALLET_FLAG_BLANK_WALLET = (1ULL << 33),
152-
};
153-
154108
static constexpr uint64_t KNOWN_WALLET_FLAGS =
155109
WALLET_FLAG_AVOID_REUSE
156110
| WALLET_FLAG_BLANK_WALLET

src/wallet/walletutil.h

+48
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,54 @@
99

1010
#include <vector>
1111

12+
/** (client) version numbers for particular wallet features */
13+
enum WalletFeature
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+
28+
FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL
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
42+
WALLET_FLAG_KEY_ORIGIN_METADATA = (1ULL << 1),
43+
44+
// will enforce the rule that the wallet can't contain any private keys (only watch-only/pubkeys)
45+
WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32),
46+
47+
//! Flag set when a wallet contains no HD seed and no private keys, scripts,
48+
//! addresses, and other watch only things, and is therefore "blank."
49+
//!
50+
//! The only function this flag serves is to distinguish a blank wallet from
51+
//! a newly created wallet when the wallet database is loaded, to avoid
52+
//! initialization that should only happen on first run.
53+
//!
54+
//! This flag is also a mandatory flag to prevent previous versions of
55+
//! bitcoin from opening the wallet, thinking it was newly created, and
56+
//! then improperly reinitializing it.
57+
WALLET_FLAG_BLANK_WALLET = (1ULL << 33),
58+
};
59+
1260
//! Get the path of the wallet directory.
1361
fs::path GetWalletDir();
1462

0 commit comments

Comments
 (0)