Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
enum WalletFlags : uint64_t { | enum WalletFlags : uint64_t { | ||||
// Wallet flags in the upper section (> 1 << 31) will lead to not opening | // Wallet flags in the upper section (> 1 << 31) will lead to not opening | ||||
// the wallet if flag is unknown. | // the wallet if flag is unknown. | ||||
// Unknown wallet flags in the lower section <= (1 << 31) will be tolerated. | // Unknown wallet flags in the lower section <= (1 << 31) will be tolerated. | ||||
// Will enforce the rule that the wallet can't contain any private keys | // Will enforce the rule that the wallet can't contain any private keys | ||||
// (only watch-only/pubkeys). | // (only watch-only/pubkeys). | ||||
WALLET_FLAG_DISABLE_PRIVATE_KEYS = (1ULL << 32), | 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 g_known_wallet_flags = | static constexpr uint64_t g_known_wallet_flags = | ||||
WALLET_FLAG_DISABLE_PRIVATE_KEYS; | WALLET_FLAG_DISABLE_PRIVATE_KEYS | WALLET_FLAG_BLANK_WALLET; | ||||
/** A key pool entry */ | /** A key pool entry */ | ||||
class CKeyPool { | class CKeyPool { | ||||
public: | public: | ||||
int64_t nTime; | int64_t nTime; | ||||
CPubKey vchPubKey; | CPubKey vchPubKey; | ||||
// for change outputs | // for change outputs | ||||
bool fInternal; | bool fInternal; | ||||
▲ Show 20 Lines • Show All 1,226 Lines • ▼ Show 20 Lines | public: | ||||
/* Set the HD chain model (chain child index counters) */ | /* Set the HD chain model (chain child index counters) */ | ||||
void SetHDChain(const CHDChain &chain, bool memonly); | void SetHDChain(const CHDChain &chain, bool memonly); | ||||
const CHDChain &GetHDChain() const { return hdChain; } | const CHDChain &GetHDChain() const { return hdChain; } | ||||
/* Returns true if HD is enabled */ | /* Returns true if HD is enabled */ | ||||
bool IsHDEnabled() const; | bool IsHDEnabled() const; | ||||
/* Returns true if the wallet can generate new keys */ | |||||
bool CanGenerateKeys(); | |||||
/* Returns true if the wallet can give out new addresses. This means it has | |||||
* keys in the keypool or can generate new keys */ | |||||
Fabien: Fix layout. | |||||
bool CanGetAddresses(bool internal = false); | |||||
/* Generates a new HD seed (will not be activated) */ | /* Generates a new HD seed (will not be activated) */ | ||||
CPubKey GenerateNewSeed(); | CPubKey GenerateNewSeed(); | ||||
/** | /** | ||||
* Derives a new HD seed (will not be activated) | * Derives a new HD seed (will not be activated) | ||||
*/ | */ | ||||
CPubKey DeriveNewSeed(const CKey &key); | CPubKey DeriveNewSeed(const CKey &key); | ||||
Show All 28 Lines | public: | ||||
void LearnAllRelatedScripts(const CPubKey &key); | void LearnAllRelatedScripts(const CPubKey &key); | ||||
/** | /** | ||||
* Set a single wallet flag. | * Set a single wallet flag. | ||||
*/ | */ | ||||
void SetWalletFlag(uint64_t flags); | void SetWalletFlag(uint64_t flags); | ||||
/** | /** | ||||
* Unsets a single wallet flag. | |||||
*/ | |||||
void UnsetWalletFlag(uint64_t flag); | |||||
/** | |||||
* Check if a certain wallet flag is set. | * Check if a certain wallet flag is set. | ||||
*/ | */ | ||||
bool IsWalletFlagSet(uint64_t flag); | bool IsWalletFlagSet(uint64_t flag); | ||||
/** | /** | ||||
* Overwrite all flags by the given uint64_t. | * Overwrite all flags by the given uint64_t. | ||||
* Returns false if unknown, non-tolerable flags are present. | * Returns false if unknown, non-tolerable flags are present. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |
Fix layout.