Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 702 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected. | * Used by TransactionAddedToMemorypool/BlockConnected/Disconnected. | ||||
* Should be called with pindexBlock and posInBlock if this is for a | * Should be called with pindexBlock and posInBlock if this is for a | ||||
* transaction that is included in a block. | * transaction that is included in a block. | ||||
*/ | */ | ||||
void SyncTransaction(const CTransactionRef &tx, | void SyncTransaction(const CTransactionRef &tx, | ||||
const CBlockIndex *pindex = nullptr, | const CBlockIndex *pindex = nullptr, | ||||
int posInBlock = 0); | int posInBlock = 0) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
/* the HD chain data model (external chain counters) */ | /* the HD chain data model (external chain counters) */ | ||||
CHDChain hdChain; | CHDChain hdChain; | ||||
/* HD derive new child key (on internal or external chain) */ | /* HD derive new child key (on internal or external chain) */ | ||||
void DeriveNewChildKey(WalletBatch &batch, CKeyMetadata &metadata, | void DeriveNewChildKey(WalletBatch &batch, CKeyMetadata &metadata, | ||||
CKey &secret, bool internal = false); | CKey &secret, bool internal = false) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
std::set<int64_t> setInternalKeyPool; | std::set<int64_t> setInternalKeyPool; | ||||
std::set<int64_t> setExternalKeyPool; | std::set<int64_t> setExternalKeyPool; | ||||
int64_t m_max_keypool_index = 0; | int64_t m_max_keypool_index = 0; | ||||
std::map<CKeyID, int64_t> m_pool_key_to_index; | std::map<CKeyID, int64_t> m_pool_key_to_index; | ||||
int64_t nTimeFirstKey = 0; | int64_t nTimeFirstKey = 0; | ||||
/** | /** | ||||
* 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) override | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
/** | /** | ||||
* Wallet filename from wallet=<path> command line or config option. | * Wallet filename from wallet=<path> command line or config option. | ||||
* Used in debug logs and to send RPCs to the right wallet instance when | * Used in debug logs and to send RPCs to the right wallet instance when | ||||
* more than one wallet is loaded. | * more than one wallet is loaded. | ||||
*/ | */ | ||||
std::string m_name; | std::string m_name; | ||||
Show All 38 Lines | bool SelectCoins(const std::vector<COutput> &vAvailableCoins, | ||||
CoinSelectionParams &coin_selection_params, | CoinSelectionParams &coin_selection_params, | ||||
bool &bnb_used) const; | bool &bnb_used) const; | ||||
/** | /** | ||||
* Get a name for this wallet for logging/debugging purposes. | * Get a name for this wallet for logging/debugging purposes. | ||||
*/ | */ | ||||
std::string GetName() const { return m_name; } | std::string GetName() const { return m_name; } | ||||
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool); | void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
// Map from Key ID to key metadata. | // Map from Key ID to key metadata. | ||||
std::map<CKeyID, CKeyMetadata> mapKeyMetadata; | std::map<CKeyID, CKeyMetadata> mapKeyMetadata; | ||||
// Map from Script ID to key metadata (for watch-only keys). | // Map from Script ID to key metadata (for watch-only keys). | ||||
std::map<CScriptID, CKeyMetadata> m_script_metadata; | std::map<CScriptID, CKeyMetadata> m_script_metadata; | ||||
typedef std::map<unsigned int, CMasterKey> MasterKeyMap; | typedef std::map<unsigned int, CMasterKey> MasterKeyMap; | ||||
Show All 24 Lines | public: | ||||
std::map<CTxDestination, CAddressBookData> mapAddressBook; | std::map<CTxDestination, CAddressBookData> mapAddressBook; | ||||
std::set<COutPoint> setLockedCoins; | std::set<COutPoint> setLockedCoins; | ||||
const CWalletTx *GetWalletTx(const TxId &txid) const; | const CWalletTx *GetWalletTx(const TxId &txid) const; | ||||
//! check whether we are allowed to upgrade (or already support) to the | //! check whether we are allowed to upgrade (or already support) to the | ||||
//! named feature | //! named feature | ||||
bool CanSupportFeature(enum WalletFeature wf) const { | bool CanSupportFeature(enum WalletFeature wf) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | |||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
return nWalletMaxVersion >= wf; | return nWalletMaxVersion >= wf; | ||||
} | } | ||||
/** | /** | ||||
* populate vCoins with vector of available COutputs. | * populate vCoins with vector of available COutputs. | ||||
*/ | */ | ||||
void AvailableCoins(std::vector<COutput> &vCoins, bool fOnlySafe = true, | void AvailableCoins(std::vector<COutput> &vCoins, bool fOnlySafe = true, | ||||
const CCoinControl *coinControl = nullptr, | const CCoinControl *coinControl = nullptr, | ||||
const Amount nMinimumAmount = SATOSHI, | const Amount nMinimumAmount = SATOSHI, | ||||
const Amount nMaximumAmount = MAX_MONEY, | const Amount nMaximumAmount = MAX_MONEY, | ||||
const Amount nMinimumSumAmount = MAX_MONEY, | const Amount nMinimumSumAmount = MAX_MONEY, | ||||
const uint64_t nMaximumCount = 0, | const uint64_t nMaximumCount = 0, | ||||
const int nMinDepth = 0, | const int nMinDepth = 0, | ||||
const int nMaxDepth = 9999999) const; | const int nMaxDepth = 9999999) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
/** | /** | ||||
* Return list of available coins and locked coins grouped by non-change | * Return list of available coins and locked coins grouped by non-change | ||||
* output address. | * output address. | ||||
*/ | */ | ||||
std::map<CTxDestination, std::vector<COutput>> ListCoins() const; | std::map<CTxDestination, std::vector<COutput>> ListCoins() const; | ||||
/** | /** | ||||
Show All 15 Lines | bool SelectCoinsMinConf(const Amount nTargetValue, | ||||
Amount &nValueRet, | Amount &nValueRet, | ||||
const CoinSelectionParams &coin_selection_params, | const CoinSelectionParams &coin_selection_params, | ||||
bool &bnb_used) const; | bool &bnb_used) const; | ||||
bool IsSpent(const COutPoint &outpoint) const; | bool IsSpent(const COutPoint &outpoint) const; | ||||
std::vector<OutputGroup> GroupOutputs(const std::vector<COutput> &outputs, | std::vector<OutputGroup> GroupOutputs(const std::vector<COutput> &outputs, | ||||
bool single_coin) const; | bool single_coin) const; | ||||
bool IsLockedCoin(const COutPoint &outpoint) const; | bool IsLockedCoin(const COutPoint &outpoint) const | ||||
void LockCoin(const COutPoint &output); | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
void UnlockCoin(const COutPoint &output); | void LockCoin(const COutPoint &output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
void UnlockAllCoins(); | void UnlockCoin(const COutPoint &output) | ||||
void ListLockedCoins(std::vector<COutPoint> &vOutpts) const; | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
void UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
void ListLockedCoins(std::vector<COutPoint> &vOutpts) const | |||||
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() { return fAbortRescan; } | ||||
bool IsScanning() { return fScanningWallet; } | bool IsScanning() { return fScanningWallet; } | ||||
/** | /** | ||||
* keystore implementation | * keystore implementation | ||||
* Generate a new key | * Generate a new key | ||||
*/ | */ | ||||
CPubKey GenerateNewKey(WalletBatch &batch, bool internal = false); | CPubKey GenerateNewKey(WalletBatch &batch, bool internal = false) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
//! Adds a key to the store, and saves it to disk. | //! Adds a key to the store, and saves it to disk. | ||||
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override; | bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, | bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, | ||||
const CPubKey &pubkey); | const CPubKey &pubkey) | ||||
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); | bool LoadKeyMetadata(const CKeyID &keyID, const CKeyMetadata &metadata) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
bool LoadScriptMetadata(const CScriptID &script_id, | bool LoadScriptMetadata(const CScriptID &script_id, | ||||
const CKeyMetadata &metadata); | const CKeyMetadata &metadata) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
bool LoadMinVersion(int nVersion) { | 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; | ||||
} | } | ||||
void UpdateTimeFirstKey(int64_t nCreateTime); | void UpdateTimeFirstKey(int64_t nCreateTime) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
//! Adds an encrypted key to the store, and saves it to disk. | //! Adds an encrypted key to the store, and saves it to disk. | ||||
bool AddCryptedKey(const CPubKey &vchPubKey, | bool AddCryptedKey(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret) override; | const std::vector<uint8_t> &vchCryptedSecret) override; | ||||
//! Adds an encrypted key to the store, without saving it to disk (used by | //! Adds an encrypted key to the store, without saving it to disk (used by | ||||
//! LoadWallet) | //! LoadWallet) | ||||
bool LoadCryptedKey(const CPubKey &vchPubKey, | bool LoadCryptedKey(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret); | const std::vector<uint8_t> &vchCryptedSecret); | ||||
Show All 11 Lines | public: | ||||
//! 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; | ||||
//! 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) | ||||
bool RemoveWatchOnly(const CScript &dest) override; | EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool RemoveWatchOnly(const CScript &dest) override | |||||
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); | ||||
//! 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 ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, | bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, | ||||
const SecureString &strNewWalletPassphrase); | const SecureString &strNewWalletPassphrase); | ||||
bool EncryptWallet(const SecureString &strWalletPassphrase); | bool EncryptWallet(const SecureString &strWalletPassphrase); | ||||
void GetKeyBirthTimes(std::map<CTxDestination, int64_t> &mapKeyBirth) const; | void GetKeyBirthTimes(std::map<CTxDestination, int64_t> &mapKeyBirth) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
unsigned int ComputeTimeSmart(const CWalletTx &wtx) const; | unsigned int ComputeTimeSmart(const CWalletTx &wtx) const; | ||||
/** | /** | ||||
* Increment the next transaction order id | * Increment the next transaction order id | ||||
* @return next transaction order id | * @return next transaction order id | ||||
*/ | */ | ||||
int64_t IncOrderPosNext(WalletBatch *batch = nullptr); | int64_t IncOrderPosNext(WalletBatch *batch = nullptr) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
DBErrors ReorderTransactions(); | DBErrors ReorderTransactions(); | ||||
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); | |||||
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); | bool 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, | ||||
const CBlockIndex *pIndex, int posInBlock, | const CBlockIndex *pIndex, int posInBlock, | ||||
bool fUpdate); | bool fUpdate) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
int64_t RescanFromTime(int64_t startTime, | int64_t RescanFromTime(int64_t startTime, | ||||
const WalletRescanReserver &reserver, bool update); | const WalletRescanReserver &reserver, bool update); | ||||
CBlockIndex *ScanForWalletTransactions(CBlockIndex *pindexStart, | CBlockIndex *ScanForWalletTransactions(CBlockIndex *pindexStart, | ||||
CBlockIndex *pindexStop, | CBlockIndex *pindexStop, | ||||
const WalletRescanReserver &reserver, | const WalletRescanReserver &reserver, | ||||
bool fUpdate = false); | bool fUpdate = false); | ||||
void TransactionRemovedFromMempool(const CTransactionRef &ptx) override; | void TransactionRemovedFromMempool(const CTransactionRef &ptx) override; | ||||
void ReacceptWalletTransactions(); | void ReacceptWalletTransactions(); | ||||
Show All 20 Lines | public: | ||||
* Insert additional inputs into the transaction by calling | * Insert additional inputs into the transaction by calling | ||||
* CreateTransaction(); | * CreateTransaction(); | ||||
*/ | */ | ||||
bool FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | bool FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | ||||
int &nChangePosInOut, std::string &strFailReason, | int &nChangePosInOut, std::string &strFailReason, | ||||
bool lockUnspents, | bool lockUnspents, | ||||
const std::set<int> &setSubtractFeeFromOutputs, | const std::set<int> &setSubtractFeeFromOutputs, | ||||
CCoinControl coinControl); | CCoinControl coinControl); | ||||
bool SignTransaction(CMutableTransaction &tx); | bool SignTransaction(CMutableTransaction &tx) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
/** | /** | ||||
* Create a new transaction paying the recipients with a set of coins | * Create a new transaction paying the recipients with a set of coins | ||||
* selected by SelectCoins(); Also create the change output, when needed | * selected by SelectCoins(); Also create the change output, when needed | ||||
* @note passing nChangePosInOut as -1 will result in setting a random | * @note passing nChangePosInOut as -1 will result in setting a random | ||||
* position | * position | ||||
*/ | */ | ||||
bool CreateTransaction(const std::vector<CRecipient> &vecSend, | bool CreateTransaction(const std::vector<CRecipient> &vecSend, | ||||
Show All 33 Lines | public: | ||||
* -fallbackfee | * -fallbackfee | ||||
*/ | */ | ||||
CFeeRate m_fallback_fee{DEFAULT_FALLBACK_FEE}; | CFeeRate m_fallback_fee{DEFAULT_FALLBACK_FEE}; | ||||
OutputType m_default_address_type{DEFAULT_ADDRESS_TYPE}; | OutputType m_default_address_type{DEFAULT_ADDRESS_TYPE}; | ||||
// Default to OutputType::NONE if not set by -changetype | // Default to OutputType::NONE if not set by -changetype | ||||
OutputType m_default_change_type{OutputType::NONE}; | OutputType m_default_change_type{OutputType::NONE}; | ||||
bool NewKeyPool(); | bool NewKeyPool(); | ||||
size_t KeypoolCountExternalKeys(); | size_t KeypoolCountExternalKeys() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | ||||
bool TopUpKeyPool(unsigned int kpSize = 0); | bool TopUpKeyPool(unsigned int kpSize = 0); | ||||
void ReserveKeyFromKeyPool(int64_t &nIndex, CKeyPool &keypool, | void ReserveKeyFromKeyPool(int64_t &nIndex, CKeyPool &keypool, | ||||
bool fRequestedInternal); | bool fRequestedInternal); | ||||
void KeepKey(int64_t nIndex); | void KeepKey(int64_t nIndex); | ||||
void ReturnKey(int64_t nIndex, bool fInternal, const CPubKey &pubkey); | void ReturnKey(int64_t nIndex, bool fInternal, const CPubKey &pubkey); | ||||
bool GetKeyFromPool(CPubKey &key, bool internal = false); | bool GetKeyFromPool(CPubKey &key, bool internal = false); | ||||
int64_t GetOldestKeyPoolTime(); | int64_t GetOldestKeyPoolTime(); | ||||
/** | /** | ||||
* Marks all keys in the keypool up to and including reserve_key as used. | * Marks all keys in the keypool up to and including reserve_key as used. | ||||
*/ | */ | ||||
void MarkReserveKeysAsUsed(int64_t keypool_id); | void MarkReserveKeysAsUsed(int64_t keypool_id) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
const std::map<CKeyID, int64_t> &GetAllReserveKeys() const { | const std::map<CKeyID, int64_t> &GetAllReserveKeys() const { | ||||
return m_pool_key_to_index; | return m_pool_key_to_index; | ||||
} | } | ||||
std::set<std::set<CTxDestination>> GetAddressGroupings(); | std::set<std::set<CTxDestination>> GetAddressGroupings() | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
std::map<CTxDestination, Amount> GetAddressBalances(); | std::map<CTxDestination, Amount> GetAddressBalances(); | ||||
std::set<CTxDestination> GetLabelAddresses(const std::string &label) const; | std::set<CTxDestination> GetLabelAddresses(const std::string &label) const; | ||||
isminetype IsMine(const CTxIn &txin) const; | isminetype IsMine(const CTxIn &txin) const; | ||||
/** | /** | ||||
* Returns amount of debit if the input matches the filter, otherwise | * Returns amount of debit if the input matches the filter, otherwise | ||||
* returns 0 | * returns 0 | ||||
Show All 11 Lines | public: | ||||
bool IsAllFromMe(const CTransaction &tx, const isminefilter &filter) const; | bool IsAllFromMe(const CTransaction &tx, const isminefilter &filter) const; | ||||
Amount GetCredit(const CTransaction &tx, const isminefilter &filter) const; | Amount GetCredit(const CTransaction &tx, const isminefilter &filter) const; | ||||
Amount GetChange(const CTransaction &tx) const; | Amount GetChange(const CTransaction &tx) const; | ||||
void ChainStateFlushed(const CBlockLocator &loc) override; | void ChainStateFlushed(const CBlockLocator &loc) override; | ||||
DBErrors LoadWallet(bool &fFirstRunRet); | DBErrors LoadWallet(bool &fFirstRunRet); | ||||
DBErrors ZapWalletTx(std::vector<CWalletTx> &vWtx); | DBErrors ZapWalletTx(std::vector<CWalletTx> &vWtx); | ||||
DBErrors ZapSelectTx(std::vector<TxId> &txIdsIn, | DBErrors ZapSelectTx(std::vector<TxId> &txIdsIn, | ||||
std::vector<TxId> &txIdsOut); | std::vector<TxId> &txIdsOut) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
bool SetAddressBook(const CTxDestination &address, | bool SetAddressBook(const CTxDestination &address, | ||||
const std::string &strName, const std::string &purpose); | const std::string &strName, const std::string &purpose); | ||||
bool DelAddressBook(const CTxDestination &address); | bool DelAddressBook(const CTxDestination &address); | ||||
const std::string &GetLabelName(const CScript &scriptPubKey) const; | const std::string &GetLabelName(const CScript &scriptPubKey) const; | ||||
void GetScriptForMining(std::shared_ptr<CReserveScript> &script); | void GetScriptForMining(std::shared_ptr<CReserveScript> &script); | ||||
unsigned int GetKeyPoolSize() { | 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, | bool SetMinVersion(enum WalletFeature, WalletBatch *batch_in = nullptr, | ||||
Show All 11 Lines | public: | ||||
} | } | ||||
//! 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; | ||||
//! Check if a given transaction has any of its outputs spent by another | //! Check if a given transaction has any of its outputs spent by another | ||||
//! transaction in the wallet | //! transaction in the wallet | ||||
bool HasWalletSpend(const TxId &txid) const; | bool HasWalletSpend(const TxId &txid) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); | |||||
//! Flush wallet (bitdb flush) | //! Flush wallet (bitdb flush) | ||||
void Flush(bool shutdown = false); | void Flush(bool shutdown = false); | ||||
/** | /** | ||||
* Address book entry changed. | * Address book entry changed. | ||||
* @note called with lock cs_wallet held. | * @note called with lock cs_wallet held. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | public: | ||||
bool SetHDMasterKey(const CPubKey &key); | bool 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(); | void BlockUntilSyncedToCurrentChain() LOCKS_EXCLUDED(cs_wallet); | ||||
/** | /** | ||||
* Explicitly make the wallet learn the related scripts for outputs to the | * Explicitly make the wallet learn the related scripts for outputs to the | ||||
* given key. This is purely to make the wallet file compatible with older | * given key. This is purely to make the wallet file compatible with older | ||||
* software, as CBasicKeyStore automatically does this implicitly for all | * software, as CBasicKeyStore automatically does this implicitly for all | ||||
* keys now. | * keys now. | ||||
*/ | */ | ||||
void LearnRelatedScripts(const CPubKey &key, OutputType); | void LearnRelatedScripts(const CPubKey &key, OutputType); | ||||
▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines |