Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 766 Lines • ▼ Show 20 Lines | private: | ||||
//! if fUseCrypto is false, vMasterKey must be empty | //! if fUseCrypto is false, vMasterKey must be empty | ||||
std::atomic<bool> fUseCrypto; | std::atomic<bool> fUseCrypto; | ||||
//! keeps track of whether Unlock has run a thorough check before | //! keeps track of whether Unlock has run a thorough check before | ||||
bool fDecryptionThoroughlyChecked; | bool fDecryptionThoroughlyChecked; | ||||
using CryptedKeyMap = | using CryptedKeyMap = | ||||
std::map<CKeyID, std::pair<CPubKey, std::vector<uint8_t>>>; | std::map<CKeyID, std::pair<CPubKey, std::vector<uint8_t>>>; | ||||
using WatchOnlySet = std::set<CScript>; | |||||
using WatchKeyMap = std::map<CKeyID, CPubKey>; | |||||
bool SetCrypted(); | bool SetCrypted(); | ||||
//! will encrypt previously unencrypted keys | //! will encrypt previously unencrypted keys | ||||
bool EncryptKeys(CKeyingMaterial &vMasterKeyIn); | bool EncryptKeys(CKeyingMaterial &vMasterKeyIn); | ||||
bool Unlock(const CKeyingMaterial &vMasterKeyIn, | bool Unlock(const CKeyingMaterial &vMasterKeyIn, | ||||
bool accept_no_keys = false); | bool accept_no_keys = false); | ||||
CryptedKeyMap mapCryptedKeys GUARDED_BY(cs_KeyStore); | CryptedKeyMap mapCryptedKeys GUARDED_BY(cs_KeyStore); | ||||
WatchOnlySet setWatchOnly GUARDED_BY(cs_KeyStore); | |||||
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore); | |||||
bool AddCryptedKeyInner(const CPubKey &vchPubKey, | bool AddCryptedKeyInner(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret); | const std::vector<uint8_t> &vchCryptedSecret); | ||||
bool AddKeyPubKeyInner(const CKey &key, const CPubKey &pubkey); | bool AddKeyPubKeyInner(const CKey &key, const CPubKey &pubkey); | ||||
std::atomic<bool> fAbortRescan{false}; | std::atomic<bool> fAbortRescan{false}; | ||||
// controlled by WalletRescanReserver | // controlled by WalletRescanReserver | ||||
std::atomic<bool> fScanningWallet{false}; | std::atomic<bool> fScanningWallet{false}; | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | private: | ||||
* Private version of AddWatchOnly method which does not accept a timestamp, | * Private version of AddWatchOnly method which does not accept a timestamp, | ||||
* and which will reset the wallet's nTimeFirstKey value to 1 if the watch | * and which will reset the wallet's nTimeFirstKey value to 1 if the watch | ||||
* key did not previously have a timestamp associated with it. Because this | * key did not previously have a timestamp associated with it. Because this | ||||
* is an inherited virtual method, it is accessible despite being marked | * is an inherited virtual method, it is accessible despite being marked | ||||
* private, but it is marked private anyway to encourage use of the other | * private, but it is marked private anyway to encourage use of the other | ||||
* AddWatchOnly which accepts a timestamp and sets nTimeFirstKey more | * AddWatchOnly which accepts a timestamp and sets nTimeFirstKey more | ||||
* intelligently for more efficient rescans. | * intelligently for more efficient rescans. | ||||
*/ | */ | ||||
bool AddWatchOnly(const CScript &dest) override | bool AddWatchOnly(const CScript &dest) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
bool AddWatchOnlyWithDB(WalletBatch &batch, const CScript &dest) | bool AddWatchOnlyWithDB(WalletBatch &batch, const CScript &dest) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool AddWatchOnlyInMem(const CScript &dest); | |||||
/** Add a KeyOriginInfo to the wallet */ | /** Add a KeyOriginInfo to the wallet */ | ||||
bool AddKeyOriginWithDB(WalletBatch &batch, const CPubKey &pubkey, | bool AddKeyOriginWithDB(WalletBatch &batch, const CPubKey &pubkey, | ||||
const KeyOriginInfo &info); | const KeyOriginInfo &info); | ||||
//! Adds a key to the store, and saves it to disk. | //! Adds a key to the store, and saves it to disk. | ||||
bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, | bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, | ||||
const CPubKey &pubkey) | const CPubKey &pubkey) | ||||
▲ Show 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | bool GetDestData(const CTxDestination &dest, const std::string &key, | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
//! Get all destination values matching a prefix. | //! Get all destination values matching a prefix. | ||||
std::vector<std::string> GetDestValues(const std::string &prefix) const | std::vector<std::string> GetDestValues(const std::string &prefix) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
//! Adds a watch-only address to the store, and saves it to disk. | //! Adds a watch-only address to the store, and saves it to disk. | ||||
bool AddWatchOnly(const CScript &dest, int64_t nCreateTime) | bool AddWatchOnly(const CScript &dest, int64_t nCreateTime) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool RemoveWatchOnly(const CScript &dest) override | bool RemoveWatchOnly(const CScript &dest) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
//! Adds a watch-only address to the store, without saving it to disk (used | //! Adds a watch-only address to the store, without saving it to disk (used | ||||
//! by LoadWallet) | //! by LoadWallet) | ||||
bool LoadWatchOnly(const CScript &dest); | bool LoadWatchOnly(const CScript &dest); | ||||
//! Returns whether the watch-only script is in the wallet | |||||
bool HaveWatchOnly(const CScript &dest) const; | |||||
//! Returns whether there are any watch-only things in the wallet | |||||
bool HaveWatchOnly() const; | |||||
//! Fetches a pubkey from mapWatchKeys if it exists there | |||||
bool GetWatchPubKey(const CKeyID &address, CPubKey &pubkey_out) const; | |||||
//! Holds a timestamp at which point the wallet is scheduled (externally) to | //! Holds a timestamp at which point the wallet is scheduled (externally) to | ||||
//! be relocked. Caller must arrange for actual relocking to occur via | //! be relocked. Caller must arrange for actual relocking to occur via | ||||
//! Lock(). | //! Lock(). | ||||
int64_t nRelockTime = 0; | int64_t nRelockTime = 0; | ||||
bool Unlock(const SecureString &strWalletPassphrase, | bool Unlock(const SecureString &strWalletPassphrase, | ||||
bool accept_no_keys = false); | bool accept_no_keys = false); | ||||
▲ Show 20 Lines • Show All 497 Lines • Show Last 20 Lines |