Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 794 Lines • ▼ Show 20 Lines | private: | ||||
int m_last_block_processed_height GUARDED_BY(cs_wallet) = -1; | int m_last_block_processed_height GUARDED_BY(cs_wallet) = -1; | ||||
bool CreateTransactionInternal(interfaces::Chain::Lock &locked_chain, | bool CreateTransactionInternal(interfaces::Chain::Lock &locked_chain, | ||||
const std::vector<CRecipient> &vecSend, | const std::vector<CRecipient> &vecSend, | ||||
CTransactionRef &tx, Amount &nFeeRet, | CTransactionRef &tx, Amount &nFeeRet, | ||||
int &nChangePosInOut, bilingual_str &error, | int &nChangePosInOut, bilingual_str &error, | ||||
const CCoinControl &coin_control, bool sign); | const CCoinControl &coin_control, bool sign); | ||||
std::map<OutputType, ScriptPubKeyMan *> m_external_spk_managers; | |||||
std::map<OutputType, ScriptPubKeyMan *> m_internal_spk_managers; | |||||
// Indexed by a unique identifier produced by each ScriptPubKeyMan using | |||||
// ScriptPubKeyMan::GetID. In many cases it will be the hash of an internal | |||||
// structure | |||||
std::map<uint256, std::unique_ptr<ScriptPubKeyMan>> m_spk_managers; | |||||
public: | public: | ||||
const CChainParams &chainParams; | const CChainParams &chainParams; | ||||
/* | /* | ||||
* Main wallet lock. | * Main wallet lock. | ||||
* This lock protects all the fields added by CWallet. | * This lock protects all the fields added by CWallet. | ||||
*/ | */ | ||||
mutable RecursiveMutex cs_wallet; | mutable RecursiveMutex cs_wallet; | ||||
▲ Show 20 Lines • Show All 587 Lines • ▼ Show 20 Lines | public: | ||||
template <typename... Params> | template <typename... Params> | ||||
void WalletLogPrintfToBeContinued(std::string fmt, | void WalletLogPrintfToBeContinued(std::string fmt, | ||||
Params... parameters) const { | Params... parameters) const { | ||||
LogPrintfToBeContinued(("%s " + fmt).c_str(), GetDisplayName(), | LogPrintfToBeContinued(("%s " + fmt).c_str(), GetDisplayName(), | ||||
parameters...); | parameters...); | ||||
}; | }; | ||||
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and | |||||
//! m_external_spk_managers | |||||
std::set<ScriptPubKeyMan *> GetActiveScriptPubKeyMans() const; | |||||
//! Returns all unique ScriptPubKeyMans | |||||
std::set<ScriptPubKeyMan *> GetAllScriptPubKeyMans() const; | |||||
//! Get the ScriptPubKeyMan for the given OutputType and internal/external | |||||
//! chain. | |||||
ScriptPubKeyMan *GetScriptPubKeyMan(const OutputType &type, | |||||
bool internal) const; | |||||
//! Get the ScriptPubKeyMan for a script | //! Get the ScriptPubKeyMan for a script | ||||
ScriptPubKeyMan *GetScriptPubKeyMan(const CScript &script) const; | ScriptPubKeyMan *GetScriptPubKeyMan(const CScript &script) const; | ||||
//! Get the ScriptPubKeyMan by id | |||||
ScriptPubKeyMan *GetScriptPubKeyMan(const uint256 &id) const; | |||||
//! Get the SigningProvider for a script | //! Get the SigningProvider for a script | ||||
const SigningProvider *GetSigningProvider(const CScript &script) const; | const SigningProvider *GetSigningProvider(const CScript &script) const; | ||||
const SigningProvider *GetSigningProvider(const CScript &script, | const SigningProvider *GetSigningProvider(const CScript &script, | ||||
SignatureData &sigdata) const; | SignatureData &sigdata) const; | ||||
//! Get the LegacyScriptPubKeyMan which is used for all types, internal, and | |||||
//! external. | |||||
LegacyScriptPubKeyMan *GetLegacyScriptPubKeyMan() const; | LegacyScriptPubKeyMan *GetLegacyScriptPubKeyMan() const; | ||||
LegacyScriptPubKeyMan *GetOrCreateLegacyScriptPubKeyMan(); | LegacyScriptPubKeyMan *GetOrCreateLegacyScriptPubKeyMan(); | ||||
//! Make a LegacyScriptPubKeyMan and set it for all types, internal, and | //! Make a LegacyScriptPubKeyMan and set it for all types, internal, and | ||||
//! external. | //! external. | ||||
void SetupLegacyScriptPubKeyMan(); | void SetupLegacyScriptPubKeyMan(); | ||||
const CKeyingMaterial &GetEncryptionKey() const override; | const CKeyingMaterial &GetEncryptionKey() const override; | ||||
bool HasEncryptionKeys() const override; | bool HasEncryptionKeys() const override; | ||||
// Temporary LegacyScriptPubKeyMan accessors and aliases. | |||||
friend class LegacyScriptPubKeyMan; | |||||
std::unique_ptr<LegacyScriptPubKeyMan> m_spk_man; | |||||
/** Get last block processed height */ | /** Get last block processed height */ | ||||
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet) { | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
assert(m_last_block_processed_height >= 0); | assert(m_last_block_processed_height >= 0); | ||||
return m_last_block_processed_height; | return m_last_block_processed_height; | ||||
}; | }; | ||||
/** Set last block processed height, currently only use in unit test */ | /** Set last block processed height, currently only use in unit test */ | ||||
void SetLastBlockProcessed(int block_height, BlockHash block_hash) | void SetLastBlockProcessed(int block_height, BlockHash block_hash) | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |