diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -99,69 +99,12 @@ class CWalletTx; class ReserveDestination; -/** (client) version numbers for particular wallet features */ -enum WalletFeature { - // the earliest version new wallets supports (only useful for - // getwalletinfo's clientversion output) - FEATURE_BASE = 10500, - - // wallet encryption - FEATURE_WALLETCRYPT = 40000, - // compressed public keys - FEATURE_COMPRPUBKEY = 60000, - - // Hierarchical key derivation after BIP32 (HD Wallet) - FEATURE_HD = 130000, - - // Wallet with HD chain split (change outputs will use m/0'/1'/k) - FEATURE_HD_SPLIT = 160300, - - // Wallet without a default key written - FEATURE_NO_DEFAULT_KEY = 190700, - - // Upgraded to HD SPLIT and can have a pre-split keypool - FEATURE_PRE_SPLIT_KEYPOOL = 200300, - - FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL, -}; - //! Default for -addresstype constexpr OutputType DEFAULT_ADDRESS_TYPE{OutputType::LEGACY}; //! Default for -changetype constexpr OutputType DEFAULT_CHANGE_TYPE{OutputType::CHANGE_AUTO}; -enum WalletFlags : uint64_t { - // Wallet flags in the upper section (> 1 << 31) will lead to not opening - // the wallet if flag is unknown. - // Unknown wallet flags in the lower section <= (1 << 31) will be tolerated. - - // will categorize coins as clean (not reused) and dirty (reused), and - // handle - // them with privacy considerations in mind - WALLET_FLAG_AVOID_REUSE = (1ULL << 0), - - // Indicates that the metadata has already been upgraded to contain key - // origins - WALLET_FLAG_KEY_ORIGIN_METADATA = (1ULL << 1), - - // Will enforce the rule that the wallet can't contain any private keys - // (only watch-only/pubkeys). - WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32), - - //! Flag set when a wallet contains no HD seed and no private keys, scripts, - //! addresses, and other watch only things, and is therefore "blank." - //! - //! The only function this flag serves is to distinguish a blank wallet from - //! a newly created wallet when the wallet database is loaded, to avoid - //! initialization that should only happen on first run. - //! - //! This flag is also a mandatory flag to prevent previous versions of - //! bitcoin from opening the wallet, thinking it was newly created, and - //! then improperly reinitializing it. - WALLET_FLAG_BLANK_WALLET = (1ULL << 33), -}; - static constexpr uint64_t KNOWN_WALLET_FLAGS = WALLET_FLAG_AVOID_REUSE | WALLET_FLAG_BLANK_WALLET | WALLET_FLAG_KEY_ORIGIN_METADATA | WALLET_FLAG_DISABLE_PRIVATE_KEYS; diff --git a/src/wallet/walletutil.h b/src/wallet/walletutil.h --- a/src/wallet/walletutil.h +++ b/src/wallet/walletutil.h @@ -9,6 +9,63 @@ #include +/** (client) version numbers for particular wallet features */ +enum WalletFeature { + // the earliest version new wallets supports (only useful for + // getwalletinfo's clientversion output) + FEATURE_BASE = 10500, + + // wallet encryption + FEATURE_WALLETCRYPT = 40000, + // compressed public keys + FEATURE_COMPRPUBKEY = 60000, + + // Hierarchical key derivation after BIP32 (HD Wallet) + FEATURE_HD = 130000, + + // Wallet with HD chain split (change outputs will use m/0'/1'/k) + FEATURE_HD_SPLIT = 160300, + + // Wallet without a default key written + FEATURE_NO_DEFAULT_KEY = 190700, + + // Upgraded to HD SPLIT and can have a pre-split keypool + FEATURE_PRE_SPLIT_KEYPOOL = 200300, + + FEATURE_LATEST = FEATURE_PRE_SPLIT_KEYPOOL, +}; + +enum WalletFlags : uint64_t { + // Wallet flags in the upper section (> 1 << 31) will lead to not opening + // the wallet if flag is unknown. + // Unknown wallet flags in the lower section <= (1 << 31) will be tolerated. + + // will categorize coins as clean (not reused) and dirty (reused), and + // handle + // them with privacy considerations in mind + WALLET_FLAG_AVOID_REUSE = (1ULL << 0), + + // Indicates that the metadata has already been upgraded to contain key + // origins + WALLET_FLAG_KEY_ORIGIN_METADATA = (1ULL << 1), + + // Will enforce the rule that the wallet can't contain any private keys + // (only watch-only/pubkeys). + WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32), + + //! Flag set when a wallet contains no HD seed and no private keys, scripts, + //! addresses, and other watch only things, and is therefore "blank." + //! + //! The only function this flag serves is to distinguish a blank wallet from + //! a newly created wallet when the wallet database is loaded, to avoid + //! initialization that should only happen on first run. + //! + //! This flag is also a mandatory flag to prevent previous versions of + //! bitcoin from opening the wallet, thinking it was newly created, and + //! then improperly reinitializing it. + WALLET_FLAG_BLANK_WALLET = (1ULL << 33), +}; + //! Get the path of the wallet directory. fs::path GetWalletDir();