Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
wallet::LegacyDataSPKM Class Reference

#include <scriptpubkeyman.h>

Inheritance diagram for wallet::LegacyDataSPKM:
[legend]
Collaboration diagram for wallet::LegacyDataSPKM:
[legend]

Public Member Functions

std::map< CKeyID, CKeyMetadata > mapKeyMetadata GUARDED_BY (cs_KeyStore)
std::map< CScriptID, CKeyMetadata > m_script_metadata GUARDED_BY (cs_KeyStore)
bool CheckDecryptionKey (const CKeyingMaterial &master_key) override
 Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the keys handled by it.
std::unordered_set< CScript, SaltedSipHasherGetScriptPubKeys () const override
 Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.
std::unique_ptr< SigningProviderGetSolvingProvider (const CScript &script) const override
uint256 GetID () const override
bool HaveKey (const CKeyID &address) const override
bool GetKey (const CKeyID &address, CKey &keyOut) const override
bool GetPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const override
bool GetKeyOrigin (const CKeyID &keyid, KeyOriginInfo &info) const override
virtual void LoadKeyMetadata (const CKeyID &keyID, const CKeyMetadata &metadata)
 Load metadata (used by LoadWallet).
virtual void LoadScriptMetadata (const CScriptID &script_id, const CKeyMetadata &metadata)
bool LoadWatchOnly (const CScript &dest)
 Adds a watch-only address to the store, without saving it to disk (used by LoadWallet).
bool HaveWatchOnly (const CScript &dest) const
 Returns whether the watch-only script is in the wallet.
bool LoadKey (const CKey &key, const CPubKey &pubkey)
 Adds a key to the store, without saving it to disk (used by LoadWallet).
bool LoadCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, bool checksum_valid)
 Adds an encrypted key to the store, without saving it to disk (used by LoadWallet).
bool LoadCScript (const CScript &redeemScript)
 Adds a CScript to the store.
void LoadHDChain (const CHDChain &chain)
 Load a HD chain model (used by LoadWallet).
void AddInactiveHDChain (const CHDChain &chain)
const CHDChainGetHDChain () const
bool GetWatchPubKey (const CKeyID &address, CPubKey &pubkey_out) const
 Fetches a pubkey from mapWatchKeys if it exists there.
std::unordered_set< CScript, SaltedSipHasherGetNotMineScriptPubKeys () const
 Retrieves scripts that were imported by bugs into the legacy spkm and are simply invalid, such as a sh(sh(pkh())) script, or not watched.
std::optional< MigrationDataMigrateToDescriptor ()
 Get the DescriptorScriptPubKeyMans (with private keys) that have the same scriptPubKeys as this LegacyScriptPubKeyMan.
bool DeleteRecordsWithDB (WalletBatch &batch)
 Delete all the records of this LegacyScriptPubKeyMan from disk.
 ScriptPubKeyMan (WalletStorage &storage)
Public Member Functions inherited from wallet::ScriptPubKeyMan
 ScriptPubKeyMan (WalletStorage &storage)
virtual ~ScriptPubKeyMan ()=default
virtual util::Result< CTxDestinationGetNewDestination (const OutputType type)
virtual bool Encrypt (const CKeyingMaterial &master_key, WalletBatch *batch)
virtual util::Result< CTxDestinationGetReservedDestination (const OutputType type, bool internal, int64_t &index)
virtual void KeepDestination (int64_t index, const OutputType &type)
virtual void ReturnDestination (int64_t index, bool internal, const CTxDestination &addr)
virtual bool TopUp (unsigned int size=0)
 Fills internal address pool.
virtual std::vector< WalletDestinationMarkUnusedAddresses (const CScript &script)
 Mark unused addresses as being used Affects all keys up to and including the one determined by provided script.
virtual bool IsHDEnabled () const
virtual bool CanGetAddresses (bool internal=false) const
virtual bool HavePrivateKeys () const
virtual bool HaveCryptedKeys () const
virtual void RewriteDB ()
 The action to do when the DB needs rewrite.
virtual unsigned int GetKeyPoolSize () const
virtual int64_t GetTimeFirstKey () const
virtual std::unique_ptr< CKeyMetadataGetMetadata (const CTxDestination &dest) const
virtual bool SignTransaction (CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors) const
 Creates new signatures and adds them to the transaction.
virtual SigningResult SignMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig) const
 Sign a message with the given script.
virtual std::optional< common::PSBTErrorFillPSBT (PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, std::optional< int > sighash_type=std::nullopt, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const
 Adds script and derivation path information to a PSBT, and optionally signs it.
template<typename... Params>
void WalletLogPrintf (util::ConstevalFormatString< sizeof...(Params)> wallet_fmt, const Params &... params) const
 Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
Public Member Functions inherited from FillableSigningProvider
virtual bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey)
virtual bool AddKey (const CKey &key)
virtual std::set< CKeyIDGetKeys () const
virtual bool AddCScript (const CScript &redeemScript)
virtual bool HaveCScript (const CScriptID &hash) const override
virtual std::set< CScriptIDGetCScripts () const
virtual bool GetCScript (const CScriptID &hash, CScript &redeemScriptOut) const override
Public Member Functions inherited from SigningProvider
virtual ~SigningProvider ()=default
virtual bool GetTaprootSpendData (const XOnlyPubKey &output_key, TaprootSpendData &spenddata) const
virtual bool GetTaprootBuilder (const XOnlyPubKey &output_key, TaprootBuilder &builder) const
virtual std::vector< CPubKeyGetMuSig2ParticipantPubkeys (const CPubKey &pubkey) const
virtual std::map< CPubKey, std::vector< CPubKey > > GetAllMuSig2ParticipantPubkeys () const
virtual void SetMuSig2SecNonce (const uint256 &id, MuSig2SecNonce &&nonce) const
virtual std::optional< std::reference_wrapper< MuSig2SecNonce > > GetMuSig2SecNonce (const uint256 &session_id) const
virtual void DeleteMuSig2Session (const uint256 &session_id) const
bool GetKeyByXOnly (const XOnlyPubKey &pubkey, CKey &key) const
bool GetPubKeyByXOnly (const XOnlyPubKey &pubkey, CPubKey &out) const
bool GetKeyOriginByXOnly (const XOnlyPubKey &pubkey, KeyOriginInfo &info) const

Private Types

using WatchOnlySet = std::set<CScript>
using WatchKeyMap = std::map<CKeyID, CPubKey>
using CryptedKeyMap = std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char>>>

Private Member Functions

CryptedKeyMap mapCryptedKeys GUARDED_BY (cs_KeyStore)
WatchOnlySet setWatchOnly GUARDED_BY (cs_KeyStore)
WatchKeyMap mapWatchKeys GUARDED_BY (cs_KeyStore)
bool AddWatchOnlyInMem (const CScript &dest)
virtual bool AddKeyPubKeyInner (const CKey &key, const CPubKey &pubkey)
bool AddCryptedKeyInner (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
std::unordered_set< CScript, SaltedSipHasherGetCandidateScriptPubKeys () const
bool IsMine (const CScript &script) const override
bool CanProvide (const CScript &script, SignatureData &sigdata) override
 Whether this ScriptPubKeyMan can provide a SigningProvider (via GetSolvingProvider) that, combined with sigdata, can produce solving data.

Private Attributes

CHDChain m_hd_chain
std::unordered_map< CKeyID, CHDChain, SaltedSipHasherm_inactive_hd_chains
bool fDecryptionThoroughlyChecked = true
 keeps track of whether Unlock has run a thorough check before

Additional Inherited Members

Public Attributes inherited from wallet::ScriptPubKeyMan
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
 Keypool has new keys.
boost::signals2::signal< void(const ScriptPubKeyMan *spkm, int64_t new_birth_time)> NotifyFirstKeyTimeChanged
 Birth time changed.
Public Attributes inherited from FillableSigningProvider
RecursiveMutex cs_KeyStore
Protected Types inherited from FillableSigningProvider
using KeyMap = std::map<CKeyID, CKey>
using ScriptMap = std::map<CScriptID, CScript>
Protected Member Functions inherited from FillableSigningProvider
KeyMap mapKeys GUARDED_BY (cs_KeyStore)
 Map of key id to unencrypted private keys known by the signing provider.
ScriptMap mapScripts GUARDED_BY (cs_KeyStore)
 Map of script id to scripts known by the signing provider.
void ImplicitlyLearnRelatedKeyScripts (const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Protected Attributes inherited from wallet::ScriptPubKeyMan
WalletStoragem_storage

Detailed Description

Definition at line 174 of file scriptpubkeyman.h.

Member Typedef Documentation

◆ CryptedKeyMap

using wallet::LegacyDataSPKM::CryptedKeyMap = std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char>>>
private

Definition at line 179 of file scriptpubkeyman.h.

◆ WatchKeyMap

Definition at line 178 of file scriptpubkeyman.h.

◆ WatchOnlySet

using wallet::LegacyDataSPKM::WatchOnlySet = std::set<CScript>
private

Definition at line 177 of file scriptpubkeyman.h.

Member Function Documentation

◆ AddCryptedKeyInner()

bool wallet::LegacyDataSPKM::AddCryptedKeyInner ( const CPubKey & vchPubKey,
const std::vector< unsigned char > & vchCryptedSecret )
private

Definition at line 329 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddInactiveHDChain()

void wallet::LegacyDataSPKM::AddInactiveHDChain ( const CHDChain & chain)

Definition at line 375 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddKeyPubKeyInner()

bool wallet::LegacyDataSPKM::AddKeyPubKeyInner ( const CKey & key,
const CPubKey & pubkey )
privatevirtual

Definition at line 313 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddWatchOnlyInMem()

bool wallet::LegacyDataSPKM::AddWatchOnlyInMem ( const CScript & dest)
private

Definition at line 357 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CanProvide()

bool wallet::LegacyDataSPKM::CanProvide ( const CScript & script,
SignatureData & sigdata )
overrideprivatevirtual

Whether this ScriptPubKeyMan can provide a SigningProvider (via GetSolvingProvider) that, combined with sigdata, can produce solving data.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 258 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckDecryptionKey()

bool wallet::LegacyDataSPKM::CheckDecryptionKey ( const CKeyingMaterial & master_key)
overridevirtual

Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the keys handled by it.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 213 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ DeleteRecordsWithDB()

bool wallet::LegacyDataSPKM::DeleteRecordsWithDB ( WalletBatch & batch)

Delete all the records of this LegacyScriptPubKeyMan from disk.

Definition at line 818 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCandidateScriptPubKeys()

std::unordered_set< CScript, SaltedSipHasher > wallet::LegacyDataSPKM::GetCandidateScriptPubKeys ( ) const
private

Definition at line 461 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHDChain()

const CHDChain & wallet::LegacyDataSPKM::GetHDChain ( ) const
inline

Definition at line 241 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ GetID()

uint256 wallet::LegacyDataSPKM::GetID ( ) const
inlineoverridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 216 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ GetKey()

bool wallet::LegacyDataSPKM::GetKey ( const CKeyID & address,
CKey & keyOut ) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 391 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetKeyOrigin()

bool wallet::LegacyDataSPKM::GetKeyOrigin ( const CKeyID & keyid,
KeyOriginInfo & info ) const
overridevirtual

Reimplemented from SigningProvider.

Definition at line 410 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNotMineScriptPubKeys()

std::unordered_set< CScript, SaltedSipHasher > wallet::LegacyDataSPKM::GetNotMineScriptPubKeys ( ) const

Retrieves scripts that were imported by bugs into the legacy spkm and are simply invalid, such as a sh(sh(pkh())) script, or not watched.

Definition at line 522 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPubKey()

bool wallet::LegacyDataSPKM::GetPubKey ( const CKeyID & address,
CPubKey & vchPubKeyOut ) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 441 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetScriptPubKeys()

std::unordered_set< CScript, SaltedSipHasher > wallet::LegacyDataSPKM::GetScriptPubKeys ( ) const
overridevirtual

Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 507 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSolvingProvider()

std::unique_ptr< SigningProvider > wallet::LegacyDataSPKM::GetSolvingProvider ( const CScript & script) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 253 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ GetWatchPubKey()

bool wallet::LegacyDataSPKM::GetWatchPubKey ( const CKeyID & address,
CPubKey & pubkey_out ) const

Fetches a pubkey from mapWatchKeys if it exists there.

Definition at line 430 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY() [1/5]

std::map< CScriptID, CKeyMetadata > m_script_metadata wallet::LegacyDataSPKM::GUARDED_BY ( cs_KeyStore )

◆ GUARDED_BY() [2/5]

std::map< CKeyID, CKeyMetadata > mapKeyMetadata wallet::LegacyDataSPKM::GUARDED_BY ( cs_KeyStore )

◆ GUARDED_BY() [3/5]

WatchKeyMap mapWatchKeys wallet::LegacyDataSPKM::GUARDED_BY ( cs_KeyStore )
private

◆ GUARDED_BY() [4/5]

WatchOnlySet setWatchOnly wallet::LegacyDataSPKM::GUARDED_BY ( cs_KeyStore )
private

◆ GUARDED_BY() [5/5]

CryptedKeyMap mapCryptedKeys wallet::LegacyDataSPKM::GUARDED_BY ( cs_KeyStore )
private

◆ HaveKey()

bool wallet::LegacyDataSPKM::HaveKey ( const CKeyID & address) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 382 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HaveWatchOnly()

bool wallet::LegacyDataSPKM::HaveWatchOnly ( const CScript & dest) const

Returns whether the watch-only script is in the wallet.

Definition at line 339 of file scriptpubkeyman.cpp.

◆ IsMine()

bool wallet::LegacyDataSPKM::IsMine ( const CScript & script) const
overrideprivatevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 200 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadCryptedKey()

bool wallet::LegacyDataSPKM::LoadCryptedKey ( const CPubKey & vchPubKey,
const std::vector< unsigned char > & vchCryptedSecret,
bool checksum_valid )

Adds an encrypted key to the store, without saving it to disk (used by LoadWallet).

Definition at line 319 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadCScript()

bool wallet::LegacyDataSPKM::LoadCScript ( const CScript & redeemScript)

Adds a CScript to the store.

Definition at line 286 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadHDChain()

void wallet::LegacyDataSPKM::LoadHDChain ( const CHDChain & chain)

Load a HD chain model (used by LoadWallet).

Definition at line 369 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ LoadKey()

bool wallet::LegacyDataSPKM::LoadKey ( const CKey & key,
const CPubKey & pubkey )

Adds a key to the store, without saving it to disk (used by LoadWallet).

Definition at line 281 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadKeyMetadata()

void wallet::LegacyDataSPKM::LoadKeyMetadata ( const CKeyID & keyID,
const CKeyMetadata & metadata )
virtual

Load metadata (used by LoadWallet).

Definition at line 301 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ LoadScriptMetadata()

void wallet::LegacyDataSPKM::LoadScriptMetadata ( const CScriptID & script_id,
const CKeyMetadata & metadata )
virtual

Definition at line 307 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ LoadWatchOnly()

bool wallet::LegacyDataSPKM::LoadWatchOnly ( const CScript & dest)

Adds a watch-only address to the store, without saving it to disk (used by LoadWallet).

Definition at line 345 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MigrateToDescriptor()

std::optional< MigrationData > wallet::LegacyDataSPKM::MigrateToDescriptor ( )

Get the DescriptorScriptPubKeyMans (with private keys) that have the same scriptPubKeys as this LegacyScriptPubKeyMan.

Does not modify this ScriptPubKeyMan.

Definition at line 532 of file scriptpubkeyman.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ScriptPubKeyMan()

Definition at line 86 of file scriptpubkeyman.h.

Member Data Documentation

◆ fDecryptionThoroughlyChecked

bool wallet::LegacyDataSPKM::fDecryptionThoroughlyChecked = true
private

keeps track of whether Unlock has run a thorough check before

Definition at line 190 of file scriptpubkeyman.h.

◆ m_hd_chain

CHDChain wallet::LegacyDataSPKM::m_hd_chain
private

Definition at line 186 of file scriptpubkeyman.h.

◆ m_inactive_hd_chains

std::unordered_map<CKeyID, CHDChain, SaltedSipHasher> wallet::LegacyDataSPKM::m_inactive_hd_chains
private

Definition at line 187 of file scriptpubkeyman.h.


The documentation for this class was generated from the following files: