Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.h
Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | public: | ||||
FillPSBT(PartiallySignedTransaction &psbt, | FillPSBT(PartiallySignedTransaction &psbt, | ||||
SigHashType sighash_type = SigHashType().withForkId(), | SigHashType sighash_type = SigHashType().withForkId(), | ||||
bool sign = true, bool bip32derivs = false) const { | bool sign = true, bool bip32derivs = false) const { | ||||
return TransactionError::INVALID_PSBT; | return TransactionError::INVALID_PSBT; | ||||
} | } | ||||
virtual uint256 GetID() const { return uint256(); } | virtual uint256 GetID() const { return uint256(); } | ||||
virtual void SetType(OutputType type, bool internal) {} | virtual void SetInternal(bool internal) {} | ||||
/** | /** | ||||
* Prepends the wallet name in logging output to ease debugging in | * Prepends the wallet name in logging output to ease debugging in | ||||
* multi-wallet use cases | * multi-wallet use cases | ||||
*/ | */ | ||||
template <typename... Params> | template <typename... Params> | ||||
void WalletLogPrintf(std::string fmt, Params... parameters) const { | void WalletLogPrintf(std::string fmt, Params... parameters) const { | ||||
LogPrintf(("%s " + fmt).c_str(), m_storage.GetDisplayName(), | LogPrintf(("%s " + fmt).c_str(), m_storage.GetDisplayName(), | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | SigningResult SignMessage(const std::string &message, const PKHash &pkhash, | ||||
std::string &str_sig) const override; | std::string &str_sig) const override; | ||||
TransactionError | TransactionError | ||||
FillPSBT(PartiallySignedTransaction &psbt, | FillPSBT(PartiallySignedTransaction &psbt, | ||||
SigHashType sighash_type = SigHashType().withForkId(), | SigHashType sighash_type = SigHashType().withForkId(), | ||||
bool sign = true, bool bip32derivs = false) const override; | bool sign = true, bool bip32derivs = false) const override; | ||||
uint256 GetID() const override; | uint256 GetID() const override; | ||||
void SetType(OutputType type, bool internal) override; | void SetInternal(bool internal) override; | ||||
// Map from Key ID to key metadata. | // Map from Key ID to key metadata. | ||||
std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_KeyStore); | std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_KeyStore); | ||||
// 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 GUARDED_BY(cs_KeyStore); | std::map<CScriptID, CKeyMetadata> m_script_metadata GUARDED_BY(cs_KeyStore); | ||||
//! Adds a key to the store, and saves it to disk. | //! Adds a key to the store, and saves it to disk. | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | private: | ||||
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 KeyMap = std::map<CKeyID, CKey>; | using KeyMap = std::map<CKeyID, CKey>; | ||||
ScriptPubKeyMap m_map_script_pub_keys GUARDED_BY(cs_desc_man); | ScriptPubKeyMap m_map_script_pub_keys GUARDED_BY(cs_desc_man); | ||||
PubKeyMap m_map_pubkeys GUARDED_BY(cs_desc_man); | PubKeyMap m_map_pubkeys GUARDED_BY(cs_desc_man); | ||||
int32_t m_max_cached_index = -1; | int32_t m_max_cached_index = -1; | ||||
OutputType m_address_type; | |||||
bool m_internal = false; | bool m_internal = false; | ||||
KeyMap m_map_keys GUARDED_BY(cs_desc_man); | KeyMap m_map_keys GUARDED_BY(cs_desc_man); | ||||
CryptedKeyMap m_map_crypted_keys GUARDED_BY(cs_desc_man); | CryptedKeyMap m_map_crypted_keys GUARDED_BY(cs_desc_man); | ||||
bool SetCrypted(); | |||||
//! keeps track of whether Unlock has run a thorough check before | //! keeps track of whether Unlock has run a thorough check before | ||||
bool m_decryption_thoroughly_checked = false; | bool m_decryption_thoroughly_checked = false; | ||||
bool AddDescriptorKeyWithDB(WalletBatch &batch, const CKey &key, | bool AddDescriptorKeyWithDB(WalletBatch &batch, const CKey &key, | ||||
const CPubKey &pubkey); | const CPubKey &pubkey); | ||||
KeyMap GetKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man); | KeyMap GetKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man); | ||||
Show All 11 Lines | private: | ||||
std::unique_ptr<FlatSigningProvider> | std::unique_ptr<FlatSigningProvider> | ||||
GetSigningProvider(int32_t index, bool include_private = false) const | GetSigningProvider(int32_t index, bool include_private = false) const | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man); | EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man); | ||||
public: | public: | ||||
DescriptorScriptPubKeyMan(WalletStorage &storage, | DescriptorScriptPubKeyMan(WalletStorage &storage, | ||||
WalletDescriptor &descriptor) | WalletDescriptor &descriptor) | ||||
: ScriptPubKeyMan(storage), m_wallet_descriptor(descriptor) {} | : ScriptPubKeyMan(storage), m_wallet_descriptor(descriptor) {} | ||||
DescriptorScriptPubKeyMan(WalletStorage &storage, OutputType address_type, | DescriptorScriptPubKeyMan(WalletStorage &storage, bool internal) | ||||
bool internal) | : ScriptPubKeyMan(storage), m_internal(internal) {} | ||||
: ScriptPubKeyMan(storage), m_address_type(address_type), | |||||
m_internal(internal) {} | |||||
mutable RecursiveMutex cs_desc_man; | mutable RecursiveMutex cs_desc_man; | ||||
bool GetNewDestination(const OutputType type, CTxDestination &dest, | bool GetNewDestination(const OutputType type, CTxDestination &dest, | ||||
std::string &error) override; | std::string &error) override; | ||||
isminetype IsMine(const CScript &script) const override; | isminetype IsMine(const CScript &script) const override; | ||||
bool CheckDecryptionKey(const CKeyingMaterial &master_key, | bool CheckDecryptionKey(const CKeyingMaterial &master_key, | ||||
Show All 14 Lines | public: | ||||
// (with or without private keys), the "keypool" is a single xpub. | // (with or without private keys), the "keypool" is a single xpub. | ||||
bool TopUp(unsigned int size = 0) override; | bool TopUp(unsigned int size = 0) override; | ||||
void MarkUnusedAddresses(const CScript &script) override; | void MarkUnusedAddresses(const CScript &script) override; | ||||
bool IsHDEnabled() const override; | bool IsHDEnabled() const override; | ||||
//! Setup descriptors based on the given CExtkey | //! Setup descriptors based on the given CExtkey | ||||
bool SetupDescriptorGeneration(const CExtKey &master_key); | bool SetupDescriptorGeneration(const CExtKey &master_key, | ||||
OutputType addr_type); | |||||
bool HavePrivateKeys() const override; | bool HavePrivateKeys() const override; | ||||
int64_t GetOldestKeyPoolTime() const override; | int64_t GetOldestKeyPoolTime() const override; | ||||
size_t KeypoolCountExternalKeys() const override; | size_t KeypoolCountExternalKeys() const override; | ||||
unsigned int GetKeyPoolSize() const override; | unsigned int GetKeyPoolSize() const override; | ||||
int64_t GetTimeFirstKey() const override; | int64_t GetTimeFirstKey() const override; | ||||
Show All 16 Lines | SigningResult SignMessage(const std::string &message, const PKHash &pkhash, | ||||
std::string &str_sig) const override; | std::string &str_sig) const override; | ||||
TransactionError | TransactionError | ||||
FillPSBT(PartiallySignedTransaction &psbt, | FillPSBT(PartiallySignedTransaction &psbt, | ||||
SigHashType sighash_type = SigHashType().withForkId(), | SigHashType sighash_type = SigHashType().withForkId(), | ||||
bool sign = true, bool bip32derivs = false) const override; | bool sign = true, bool bip32derivs = false) const override; | ||||
uint256 GetID() const override; | uint256 GetID() const override; | ||||
void SetType(OutputType type, bool internal) override; | void SetInternal(bool internal) override; | ||||
void SetCache(const DescriptorCache &cache); | void SetCache(const DescriptorCache &cache); | ||||
bool AddKey(const CKeyID &key_id, const CKey &key); | bool AddKey(const CKeyID &key_id, const CKey &key); | ||||
bool AddCryptedKey(const CKeyID &key_id, const CPubKey &pubkey, | bool AddCryptedKey(const CKeyID &key_id, const CPubKey &pubkey, | ||||
const std::vector<uint8_t> &crypted_key); | const std::vector<uint8_t> &crypted_key); | ||||
bool HasWalletDescriptor(const WalletDescriptor &desc) const; | bool HasWalletDescriptor(const WalletDescriptor &desc) const; | ||||
Show All 9 Lines |