Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
* transaction and that transaction was not completed and needed to be aborted). | * transaction and that transaction was not completed and needed to be aborted). | ||||
* | * | ||||
* If an address is reserved and KeepDestination() is not called, then the | * If an address is reserved and KeepDestination() is not called, then the | ||||
* address will be returned when the ReserveDestination goes out of scope. | * address will be returned when the ReserveDestination goes out of scope. | ||||
*/ | */ | ||||
class ReserveDestination { | class ReserveDestination { | ||||
protected: | protected: | ||||
//! The wallet to reserve from | //! The wallet to reserve from | ||||
CWallet *const pwallet; | const CWallet *const pwallet; | ||||
//! The ScriptPubKeyMan to reserve from. Based on type when | //! The ScriptPubKeyMan to reserve from. Based on type when | ||||
//! GetReservedDestination is called | //! GetReservedDestination is called | ||||
ScriptPubKeyMan *m_spk_man{nullptr}; | ScriptPubKeyMan *m_spk_man{nullptr}; | ||||
OutputType const type; | OutputType const type; | ||||
//! The index of the address's key in the keypool | //! The index of the address's key in the keypool | ||||
int64_t nIndex{-1}; | int64_t nIndex{-1}; | ||||
//! The destination | //! The destination | ||||
CTxDestination address; | CTxDestination address; | ||||
▲ Show 20 Lines • Show All 797 Lines • ▼ Show 20 Lines | public: | ||||
void UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | void UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
void ListLockedCoins(std::vector<COutPoint> &vOutpts) const | void ListLockedCoins(std::vector<COutPoint> &vOutpts) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
/* | /* | ||||
* Rescan abort properties | * Rescan abort properties | ||||
*/ | */ | ||||
void AbortRescan() { fAbortRescan = true; } | void AbortRescan() { fAbortRescan = true; } | ||||
bool IsAbortingRescan() { return fAbortRescan; } | bool IsAbortingRescan() const { return fAbortRescan; } | ||||
bool IsScanning() { return fScanningWallet; } | bool IsScanning() const { return fScanningWallet; } | ||||
int64_t ScanningDuration() const { | int64_t ScanningDuration() const { | ||||
return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; | return fScanningWallet ? GetTimeMillis() - m_scanning_start : 0; | ||||
} | } | ||||
double ScanningProgress() const { | double ScanningProgress() const { | ||||
return fScanningWallet ? double(m_scanning_progress) : 0; | return fScanningWallet ? double(m_scanning_progress) : 0; | ||||
} | } | ||||
//! Upgrade stored CKeyMetadata objects to store key origin info as | //! Upgrade stored CKeyMetadata objects to store key origin info as | ||||
▲ Show 20 Lines • Show All 218 Lines • ▼ Show 20 Lines | public: | ||||
OutputType m_default_address_type{DEFAULT_ADDRESS_TYPE}; | OutputType m_default_address_type{DEFAULT_ADDRESS_TYPE}; | ||||
OutputType m_default_change_type{DEFAULT_CHANGE_TYPE}; | OutputType m_default_change_type{DEFAULT_CHANGE_TYPE}; | ||||
/** | /** | ||||
* Absolute maximum transaction fee (in satoshis) used by default for the | * Absolute maximum transaction fee (in satoshis) used by default for the | ||||
* wallet. | * wallet. | ||||
*/ | */ | ||||
Amount m_default_max_tx_fee{DEFAULT_TRANSACTION_MAXFEE}; | Amount m_default_max_tx_fee{DEFAULT_TRANSACTION_MAXFEE}; | ||||
size_t KeypoolCountExternalKeys() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool TopUpKeyPool(unsigned int kpSize = 0); | bool TopUpKeyPool(unsigned int kpSize = 0); | ||||
int64_t GetOldestKeyPoolTime(); | int64_t GetOldestKeyPoolTime() const; | ||||
std::set<std::set<CTxDestination>> GetAddressGroupings() | std::set<std::set<CTxDestination>> GetAddressGroupings() const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
std::map<CTxDestination, Amount> GetAddressBalances(); | std::map<CTxDestination, Amount> GetAddressBalances() const; | ||||
std::set<CTxDestination> GetLabelAddresses(const std::string &label) const; | std::set<CTxDestination> GetLabelAddresses(const std::string &label) const; | ||||
/** | /** | ||||
* Marks all outputs in each one of the destinations dirty, so their cache | * Marks all outputs in each one of the destinations dirty, so their cache | ||||
* is reset and does not return outdated information. | * is reset and does not return outdated information. | ||||
*/ | */ | ||||
void MarkDestinationsDirty(const std::set<CTxDestination> &destinations) | void MarkDestinationsDirty(const std::set<CTxDestination> &destinations) | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | void SetMinVersion(enum WalletFeature, WalletBatch *batch_in = nullptr, | ||||
bool fExplicit = false) override; | bool fExplicit = false) override; | ||||
//! 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) | ||||
int GetVersion() { | int GetVersion() const { | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
return nWalletVersion; | return nWalletVersion; | ||||
} | } | ||||
//! Get wallet transactions that conflict with given transaction (spend same | //! Get wallet transactions that conflict with given transaction (spend same | ||||
//! outputs) | //! outputs) | ||||
std::set<TxId> GetConflicts(const TxId &txid) const | std::set<TxId> GetConflicts(const TxId &txid) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Wallet post-init setup | * Wallet post-init setup | ||||
* 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) const; | ||||
/* Returns true if HD is enabled */ | /* Returns true if HD is enabled */ | ||||
bool IsHDEnabled() const; | bool IsHDEnabled() const; | ||||
/** | /** | ||||
* Returns true if the wallet can give out new addresses. This means it has | * Returns true if the wallet can give out new addresses. This means it has | ||||
* keys in the keypool or can generate new keys. | * keys in the keypool or can generate new keys. | ||||
*/ | */ | ||||
bool CanGetAddresses(bool internal = false); | bool CanGetAddresses(bool internal = false) const; | ||||
/** | /** | ||||
* 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() const | ||||
LOCKS_EXCLUDED(cs_main, cs_wallet); | |||||
/** | /** | ||||
* 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. | * Unsets a single wallet flag. | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |