Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 913 Lines • ▼ Show 20 Lines | bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, | ||||
const CPubKey &pubkey) | const CPubKey &pubkey) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
//! Adds a key to the store, without saving it to disk (used by LoadWallet) | //! Adds a key to the store, without saving it to disk (used by LoadWallet) | ||||
bool LoadKey(const CKey &key, const CPubKey &pubkey) { | bool LoadKey(const CKey &key, const CPubKey &pubkey) { | ||||
return CCryptoKeyStore::AddKeyPubKey(key, pubkey); | return CCryptoKeyStore::AddKeyPubKey(key, pubkey); | ||||
} | } | ||||
//! Load metadata (used by LoadWallet) | //! Load metadata (used by LoadWallet) | ||||
bool LoadKeyMetadata(const CKeyID &keyID, const CKeyMetadata &metadata) | void LoadKeyMetadata(const CKeyID &keyID, const CKeyMetadata &metadata) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool LoadScriptMetadata(const CScriptID &script_id, | void LoadScriptMetadata(const CScriptID &script_id, | ||||
const CKeyMetadata &metadata) | const CKeyMetadata &metadata) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool LoadMinVersion(int nVersion) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | bool LoadMinVersion(int nVersion) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
nWalletVersion = nVersion; | nWalletVersion = nVersion; | ||||
nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); | nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); | ||||
return true; | return true; | ||||
Show All 12 Lines | public: | ||||
bool LoadCScript(const CScript &redeemScript); | bool LoadCScript(const CScript &redeemScript); | ||||
//! Adds a destination data tuple to the store, and saves it to disk | //! Adds a destination data tuple to the store, and saves it to disk | ||||
bool AddDestData(const CTxDestination &dest, const std::string &key, | bool AddDestData(const CTxDestination &dest, const std::string &key, | ||||
const std::string &value); | const std::string &value); | ||||
//! Erases a destination data tuple in the store and on disk | //! Erases a destination data tuple in the store and on disk | ||||
bool EraseDestData(const CTxDestination &dest, const std::string &key); | bool EraseDestData(const CTxDestination &dest, const std::string &key); | ||||
//! Adds a destination data tuple to the store, without saving it to disk | //! Adds a destination data tuple to the store, without saving it to disk | ||||
bool LoadDestData(const CTxDestination &dest, const std::string &key, | void LoadDestData(const CTxDestination &dest, const std::string &key, | ||||
const std::string &value); | const std::string &value); | ||||
//! Look up a destination data tuple in the store, return true if found | //! Look up a destination data tuple in the store, return true if found | ||||
//! false otherwise | //! false otherwise | ||||
bool GetDestData(const CTxDestination &dest, const std::string &key, | bool GetDestData(const CTxDestination &dest, const std::string &key, | ||||
std::string *value) const; | std::string *value) const; | ||||
//! 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; | ||||
Show All 30 Lines | public: | ||||
bool AccountMove(std::string strFrom, std::string strTo, | bool AccountMove(std::string strFrom, std::string strTo, | ||||
const Amount nAmount, std::string strComment = "") | const Amount nAmount, std::string strComment = "") | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool GetLabelDestination(CTxDestination &dest, const std::string &label, | bool GetLabelDestination(CTxDestination &dest, const std::string &label, | ||||
bool bForceNew = false); | bool bForceNew = false); | ||||
void MarkDirty(); | void MarkDirty(); | ||||
bool AddToWallet(const CWalletTx &wtxIn, bool fFlushOnClose = true); | bool AddToWallet(const CWalletTx &wtxIn, bool fFlushOnClose = true); | ||||
bool LoadToWallet(const CWalletTx &wtxIn); | void LoadToWallet(const CWalletTx &wtxIn); | ||||
void TransactionAddedToMempool(const CTransactionRef &tx) override; | void TransactionAddedToMempool(const CTransactionRef &tx) override; | ||||
void | void | ||||
BlockConnected(const std::shared_ptr<const CBlock> &pblock, | BlockConnected(const std::shared_ptr<const CBlock> &pblock, | ||||
const CBlockIndex *pindex, | const CBlockIndex *pindex, | ||||
const std::vector<CTransactionRef> &vtxConflicted) override; | const std::vector<CTransactionRef> &vtxConflicted) override; | ||||
void | void | ||||
BlockDisconnected(const std::shared_ptr<const CBlock> &pblock) override; | BlockDisconnected(const std::shared_ptr<const CBlock> &pblock) override; | ||||
bool AddToWalletIfInvolvingMe(const CTransactionRef &tx, | bool AddToWalletIfInvolvingMe(const CTransactionRef &tx, | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | public: | ||||
unsigned int GetKeyPoolSize() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | unsigned int GetKeyPoolSize() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | ||||
// set{Ex,In}ternalKeyPool | // set{Ex,In}ternalKeyPool | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
return setInternalKeyPool.size() + setExternalKeyPool.size(); | return setInternalKeyPool.size() + setExternalKeyPool.size(); | ||||
} | } | ||||
//! signify that a particular wallet feature is now used. this may change | //! signify that a particular wallet feature is now used. this may change | ||||
//! nWalletVersion and nWalletMaxVersion if those are lower | //! nWalletVersion and nWalletMaxVersion if those are lower | ||||
bool SetMinVersion(enum WalletFeature, WalletBatch *batch_in = nullptr, | void SetMinVersion(enum WalletFeature, WalletBatch *batch_in = nullptr, | ||||
bool fExplicit = false); | bool fExplicit = false); | ||||
//! change which version we're allowed to upgrade to (note that this does | //! change which version we're allowed to upgrade to (note that this does | ||||
//! not immediately imply upgrading to that format) | //! not immediately imply upgrading to that format) | ||||
bool SetMaxVersion(int nVersion); | bool SetMaxVersion(int nVersion); | ||||
//! get the current wallet format (the oldest client version guaranteed to | //! get the current wallet format (the oldest client version guaranteed to | ||||
//! understand this wallet) | //! understand this wallet) | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | public: | ||||
* Gives the wallet a chance to register repetitive tasks and complete | * Gives the wallet a chance to register repetitive tasks and complete | ||||
* post-init tasks | * post-init tasks | ||||
*/ | */ | ||||
void postInitProcess(); | void postInitProcess(); | ||||
bool BackupWallet(const std::string &strDest); | bool BackupWallet(const std::string &strDest); | ||||
/* Set the HD chain model (chain child index counters) */ | /* Set the HD chain model (chain child index counters) */ | ||||
bool 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; | ||||
/* Generates a new HD master key (will not be activated) */ | /* Generates a new HD master key (will not be activated) */ | ||||
CPubKey GenerateNewHDMasterKey(); | CPubKey GenerateNewHDMasterKey(); | ||||
/** | /** | ||||
* Set the current HD master key (will reset the chain child index counters) | * Set the current HD master key (will reset the chain child index counters) | ||||
* Sets the master key's version based on the current wallet version (so the | * Sets the master key's version based on the current wallet version (so the | ||||
* caller must ensure the current wallet version is correct before calling | * caller must ensure the current wallet version is correct before calling | ||||
* this function). | * this function). | ||||
*/ | */ | ||||
bool SetHDMasterKey(const CPubKey &key); | void SetHDMasterKey(const CPubKey &key); | ||||
/** | /** | ||||
* Blocks until the wallet state is up-to-date to /at least/ the current | * Blocks until the wallet state is up-to-date to /at least/ the current | ||||
* chain at the time this function is entered. | * chain at the time this function is entered. | ||||
* Obviously holding cs_main/cs_wallet when going into this call may cause | * Obviously holding cs_main/cs_wallet when going into this call may cause | ||||
* deadlock | * deadlock | ||||
*/ | */ | ||||
void BlockUntilSyncedToCurrentChain() LOCKS_EXCLUDED(cs_main, cs_wallet); | void BlockUntilSyncedToCurrentChain() LOCKS_EXCLUDED(cs_main, cs_wallet); | ||||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |