Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | List of all members
wallet::LegacyScriptPubKeyMan Class Reference

#include <scriptpubkeyman.h>

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

Public Member Functions

 LegacyScriptPubKeyMan (WalletStorage &storage, int64_t keypool_size)
 
util::Result< CTxDestinationGetNewDestination (const OutputType type) override
 
bool Encrypt (const CKeyingMaterial &master_key, WalletBatch *batch) override
 
util::Result< CTxDestinationGetReservedDestination (const OutputType type, bool internal, int64_t &index, CKeyPool &keypool) override
 
void KeepDestination (int64_t index, const OutputType &type) override
 
void ReturnDestination (int64_t index, bool internal, const CTxDestination &) override
 
bool TopUp (unsigned int size=0) override
 Fills internal address pool. More...
 
std::vector< WalletDestinationMarkUnusedAddresses (const CScript &script) override
 Mark unused addresses as being used Affects all keys up to and including the one determined by provided script. More...
 
void UpgradeKeyMetadata ()
 Upgrade stored CKeyMetadata objects to store key origin info as KeyOriginInfo. More...
 
bool IsHDEnabled () const override
 
bool SetupGeneration (bool force=false) override
 Sets up the key generation stuff, i.e. More...
 
bool Upgrade (int prev_version, int new_version, bilingual_str &error) override
 Upgrades the wallet to the specified version. More...
 
bool HavePrivateKeys () const override
 
void RewriteDB () override
 The action to do when the DB needs rewrite. More...
 
std::optional< int64_t > GetOldestKeyPoolTime () const override
 
size_t KeypoolCountExternalKeys () const
 
unsigned int GetKeyPoolSize () const override
 
int64_t GetTimeFirstKey () const override
 
std::unique_ptr< CKeyMetadataGetMetadata (const CTxDestination &dest) const override
 
bool CanGetAddresses (bool internal=false) 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. More...
 
bool SignTransaction (CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors) const override
 Creates new signatures and adds them to the transaction. More...
 
SigningResult SignMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig) const override
 Sign a message with the given script. More...
 
std::optional< common::PSBTErrorFillPSBT (PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=SIGHASH_DEFAULT, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const override
 Adds script and derivation path information to a PSBT, and optionally signs it. More...
 
uint256 GetID () const override
 
bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey) override
 Adds a key to the store, and saves it to disk. More...
 
bool AddCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
 Adds an encrypted key to the store, and saves it to disk. More...
 
void UpdateTimeFirstKey (int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Update wallet first key creation time. More...
 
void LoadKeyMetadata (const CKeyID &keyID, const CKeyMetadata &metadata) override
 Load metadata (used by LoadWallet) More...
 
void LoadScriptMetadata (const CScriptID &script_id, const CKeyMetadata &metadata) override
 
CPubKey GenerateNewKey (WalletBatch &batch, CHDChain &hd_chain, bool internal=false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Generate a new key. More...
 
void AddHDChain (const CHDChain &chain)
 
bool RemoveWatchOnly (const CScript &dest)
 Remove a watch only script from the keystore. More...
 
bool AddWatchOnly (const CScript &dest, int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool AddCScript (const CScript &redeemScript) override
 
bool NewKeyPool ()
 Mark old keypool keys as used, and generate all new keys. More...
 
void MarkPreSplitKeys () EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool ImportScripts (const std::set< CScript > scripts, int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool ImportPrivKeys (const std::map< CKeyID, CKey > &privkey_map, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool ImportPubKeys (const std::vector< std::pair< CKeyID, bool > > &ordered_pubkeys, const std::map< CKeyID, CPubKey > &pubkey_map, const std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo > > &key_origins, const bool add_keypool, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool ImportScriptPubKeys (const std::set< CScript > &script_pub_keys, const bool have_solving_data, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool CanGenerateKeys () const
 
CPubKey GenerateNewSeed ()
 
CPubKey DeriveNewSeed (const CKey &key)
 
void SetHDSeed (const CPubKey &key)
 
void LearnRelatedScripts (const CPubKey &key, OutputType)
 Explicitly make the wallet learn the related scripts for outputs to the given key. More...
 
void LearnAllRelatedScripts (const CPubKey &key)
 Same as LearnRelatedScripts, but when the OutputType is not known (and could be anything). More...
 
std::vector< CKeyPoolMarkReserveKeysAsUsed (int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Marks all keys in the keypool up to and including the provided key as used. More...
 
const std::map< CKeyID, int64_t > & GetAllReserveKeys () const
 
std::set< CKeyIDGetKeys () const override
 
- Public Member Functions inherited from wallet::LegacyDataSPKM
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. More...
 
std::unordered_set< CScript, SaltedSipHasherGetScriptPubKeys () const override
 Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches. More...
 
std::unique_ptr< SigningProviderGetSolvingProvider (const CScript &script) const override
 
uint256 GetID () const override
 
isminetype IsMine (const CScript &script) 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
 
std::set< int64_t > setInternalKeyPool GUARDED_BY (cs_KeyStore)
 
std::set< int64_t > setExternalKeyPool GUARDED_BY (cs_KeyStore)
 
std::set< int64_t > set_pre_split_keypool GUARDED_BY (cs_KeyStore)
 
int64_t m_max_keypool_index GUARDED_BY (cs_KeyStore)=0
 
virtual void LoadKeyMetadata (const CKeyID &keyID, const CKeyMetadata &metadata)
 Load metadata (used by LoadWallet) More...
 
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) More...
 
bool HaveWatchOnly (const CScript &dest) const
 Returns whether the watch-only script is in the wallet. More...
 
bool HaveWatchOnly () const
 Returns whether there are any watch-only things in the wallet. More...
 
bool LoadKey (const CKey &key, const CPubKey &pubkey)
 Adds a key to the store, without saving it to disk (used by LoadWallet) More...
 
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) More...
 
bool LoadCScript (const CScript &redeemScript)
 Adds a CScript to the store. More...
 
void LoadHDChain (const CHDChain &chain)
 Load a HD chain model (used by LoadWallet) More...
 
void AddInactiveHDChain (const CHDChain &chain)
 
const CHDChainGetHDChain () const
 
void LoadKeyPool (int64_t nIndex, const CKeyPool &keypool)
 Load a keypool entry. More...
 
bool GetWatchPubKey (const CKeyID &address, CPubKey &pubkey_out) const
 Fetches a pubkey from mapWatchKeys if it exists there. More...
 
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. More...
 
std::optional< MigrationDataMigrateToDescriptor ()
 Get the DescriptorScriptPubKeyMans (with private keys) that have the same scriptPubKeys as this LegacyScriptPubKeyMan. More...
 
bool DeleteRecords ()
 Delete all the records of this LegacyScriptPubKeyMan from disk. More...
 
bool DeleteRecordsWithDB (WalletBatch &batch)
 
 ScriptPubKeyMan (WalletStorage &storage)
 
- Public Member Functions inherited from wallet::ScriptPubKeyMan
 ScriptPubKeyMan (WalletStorage &storage)
 
virtual ~ScriptPubKeyMan ()=default
 
virtual util::Result< CTxDestinationGetNewDestination (const OutputType type)
 
virtual isminetype IsMine (const CScript &script) const
 
virtual bool CheckDecryptionKey (const CKeyingMaterial &master_key)
 Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the keys handled by it. More...
 
virtual bool Encrypt (const CKeyingMaterial &master_key, WalletBatch *batch)
 
virtual util::Result< CTxDestinationGetReservedDestination (const OutputType type, bool internal, int64_t &index, CKeyPool &keypool)
 
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. More...
 
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. More...
 
virtual bool SetupGeneration (bool force=false)
 Sets up the key generation stuff, i.e. More...
 
virtual bool IsHDEnabled () const
 
virtual bool CanGetAddresses (bool internal=false) const
 
virtual bool Upgrade (int prev_version, int new_version, bilingual_str &error)
 Upgrades the wallet to the specified version. More...
 
virtual bool HavePrivateKeys () const
 
virtual void RewriteDB ()
 The action to do when the DB needs rewrite. More...
 
virtual std::optional< int64_t > GetOldestKeyPoolTime () const
 
virtual unsigned int GetKeyPoolSize () const
 
virtual int64_t GetTimeFirstKey () const
 
virtual std::unique_ptr< CKeyMetadataGetMetadata (const CTxDestination &dest) const
 
virtual std::unique_ptr< SigningProviderGetSolvingProvider (const CScript &script) const
 
virtual bool CanProvide (const CScript &script, SignatureData &sigdata)
 Whether this ScriptPubKeyMan can provide a SigningProvider (via GetSolvingProvider) that, combined with sigdata, can produce solving data. More...
 
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. More...
 
virtual SigningResult SignMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig) const
 Sign a message with the given script. More...
 
virtual std::optional< common::PSBTErrorFillPSBT (PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=SIGHASH_DEFAULT, 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. More...
 
virtual uint256 GetID () const
 
virtual std::unordered_set< CScript, SaltedSipHasherGetScriptPubKeys () const
 Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches. More...
 
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. More...
 
- Public Member Functions inherited from FillableSigningProvider
virtual bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey)
 
virtual bool AddKey (const CKey &key)
 
virtual bool GetPubKey (const CKeyID &address, CPubKey &vchPubKeyOut) const override
 
virtual bool HaveKey (const CKeyID &address) const override
 
virtual std::set< CKeyIDGetKeys () const
 
virtual bool GetKey (const CKeyID &address, CKey &keyOut) const override
 
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 GetCScript (const CScriptID &scriptid, CScript &script) const
 
virtual bool HaveCScript (const CScriptID &scriptid) const
 
virtual bool GetPubKey (const CKeyID &address, CPubKey &pubkey) const
 
virtual bool GetKey (const CKeyID &address, CKey &key) const
 
virtual bool HaveKey (const CKeyID &address) const
 
virtual bool GetKeyOrigin (const CKeyID &keyid, KeyOriginInfo &info) const
 
virtual bool GetTaprootSpendData (const XOnlyPubKey &output_key, TaprootSpendData &spenddata) const
 
virtual bool GetTaprootBuilder (const XOnlyPubKey &output_key, TaprootBuilder &builder) 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 Member Functions

WalletBatch *encrypted_batch GUARDED_BY (cs_KeyStore)
 
int64_t nTimeFirstKey GUARDED_BY (cs_KeyStore)
 
int64_t m_keypool_size GUARDED_BY (cs_KeyStore)
 Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments) More...
 
bool AddKeyPubKeyInner (const CKey &key, const CPubKey &pubkey) override
 
bool AddWatchOnly (const CScript &dest) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 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 key did not previously have a timestamp associated with it. More...
 
bool AddWatchOnlyWithDB (WalletBatch &batch, const CScript &dest) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool AddWatchOnlyWithDB (WalletBatch &batch, const CScript &dest, int64_t create_time) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Adds a watch-only address to the store, and saves it to disk. More...
 
bool AddKeyPubKeyWithDB (WalletBatch &batch, const CKey &key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Adds a key to the store, and saves it to disk. More...
 
void AddKeypoolPubkeyWithDB (const CPubKey &pubkey, const bool internal, WalletBatch &batch)
 
bool AddCScriptWithDB (WalletBatch &batch, const CScript &script)
 Adds a script to the store and saves it to disk. More...
 
bool AddKeyOriginWithDB (WalletBatch &batch, const CPubKey &pubkey, const KeyOriginInfo &info)
 Add a KeyOriginInfo to the wallet. More...
 
void DeriveNewChildKey (WalletBatch &batch, CKeyMetadata &metadata, CKey &secret, CHDChain &hd_chain, bool internal=false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
bool GetKeyFromPool (CPubKey &key, const OutputType type)
 Fetches a key from the keypool. More...
 
bool ReserveKeyFromKeyPool (int64_t &nIndex, CKeyPool &keypool, bool fRequestedInternal)
 Reserves a key from the keypool and sets nIndex to its index. More...
 
bool TopUpInactiveHDChain (const CKeyID seed_id, int64_t index, bool internal)
 Like TopUp() but adds keys for inactive HD chains. More...
 
bool TopUpChain (WalletBatch &batch, CHDChain &chain, unsigned int size)
 

Private Attributes

std::map< int64_t, CKeyIDm_index_to_reserved_key
 

Additional Inherited Members

- Public Attributes inherited from wallet::LegacyDataSPKM
std::map< CKeyID, int64_t > m_pool_key_to_index
 
- Public Attributes inherited from wallet::ScriptPubKeyMan
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
 Watch-only address added. More...
 
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
 Keypool has new keys. More...
 
boost::signals2::signal< void(const ScriptPubKeyMan *spkm, int64_t new_birth_time)> NotifyFirstKeyTimeChanged
 Birth time changed. More...
 
- Public Attributes inherited from FillableSigningProvider
RecursiveMutex cs_KeyStore
 
- Protected Types inherited from wallet::LegacyDataSPKM
using WatchOnlySet = std::set< CScript >
 
using WatchKeyMap = std::map< CKeyID, CPubKey >
 
using CryptedKeyMap = std::map< CKeyID, std::pair< CPubKey, std::vector< unsigned char > > >
 
- Protected Types inherited from FillableSigningProvider
using KeyMap = std::map< CKeyID, CKey >
 
using ScriptMap = std::map< CScriptID, CScript >
 
- Protected Member Functions inherited from wallet::LegacyDataSPKM
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)
 
- 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. More...
 
ScriptMap mapScripts GUARDED_BY (cs_KeyStore)
 Map of script id to scripts known by the signing provider. More...
 
void ImplicitlyLearnRelatedKeyScripts (const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 
- Protected Attributes inherited from wallet::LegacyDataSPKM
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 More...
 
- Protected Attributes inherited from wallet::ScriptPubKeyMan
WalletStoragem_storage
 

Detailed Description

Definition at line 375 of file scriptpubkeyman.h.

Constructor & Destructor Documentation

◆ LegacyScriptPubKeyMan()

wallet::LegacyScriptPubKeyMan::LegacyScriptPubKeyMan ( WalletStorage storage,
int64_t  keypool_size 
)
inline

Definition at line 452 of file scriptpubkeyman.h.

Member Function Documentation

◆ AddCryptedKey()

bool wallet::LegacyScriptPubKeyMan::AddCryptedKey ( const CPubKey vchPubKey,
const std::vector< unsigned char > &  vchCryptedSecret 
)

Adds an encrypted key to the store, and saves it to disk.

Definition at line 869 of file scriptpubkeyman.cpp.

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

◆ AddCScript()

bool wallet::LegacyScriptPubKeyMan::AddCScript ( const CScript redeemScript)
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 1571 of file scriptpubkeyman.cpp.

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

◆ AddCScriptWithDB()

bool wallet::LegacyScriptPubKeyMan::AddCScriptWithDB ( WalletBatch batch,
const CScript script 
)
private

Adds a script to the store and saves it to disk.

Definition at line 1577 of file scriptpubkeyman.cpp.

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

◆ AddHDChain()

void wallet::LegacyScriptPubKeyMan::AddHDChain ( const CHDChain chain)

Definition at line 982 of file scriptpubkeyman.cpp.

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

◆ AddKeyOriginWithDB()

bool wallet::LegacyScriptPubKeyMan::AddKeyOriginWithDB ( WalletBatch batch,
const CPubKey pubkey,
const KeyOriginInfo info 
)
private

Add a KeyOriginInfo to the wallet.

Definition at line 1588 of file scriptpubkeyman.cpp.

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

◆ AddKeypoolPubkeyWithDB()

void wallet::LegacyScriptPubKeyMan::AddKeypoolPubkeyWithDB ( const CPubKey pubkey,
const bool  internal,
WalletBatch batch 
)
private

Definition at line 1374 of file scriptpubkeyman.cpp.

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

◆ AddKeyPubKey()

bool wallet::LegacyScriptPubKeyMan::AddKeyPubKey ( const CKey key,
const CPubKey pubkey 
)
overridevirtual

Adds a key to the store, and saves it to disk.

Reimplemented from FillableSigningProvider.

Definition at line 730 of file scriptpubkeyman.cpp.

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

◆ AddKeyPubKeyInner()

bool wallet::LegacyScriptPubKeyMan::AddKeyPubKeyInner ( const CKey key,
const CPubKey pubkey 
)
overrideprivatevirtual

Reimplemented from wallet::LegacyDataSPKM.

Definition at line 824 of file scriptpubkeyman.cpp.

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

◆ AddKeyPubKeyWithDB()

bool wallet::LegacyScriptPubKeyMan::AddKeyPubKeyWithDB ( WalletBatch batch,
const CKey key,
const CPubKey pubkey 
)
private

Adds a key to the store, and saves it to disk.

Definition at line 737 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnly() [1/2]

bool wallet::LegacyScriptPubKeyMan::AddWatchOnly ( const CScript dest)
private

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 key did not previously have a timestamp associated with it.

Because this is an inherited virtual method, it is accessible despite being marked private, but it is marked private anyway to encourage use of the other AddWatchOnly which accepts a timestamp and sets nTimeFirstKey more intelligently for more efficient rescans.

Definition at line 964 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnly() [2/2]

bool wallet::LegacyScriptPubKeyMan::AddWatchOnly ( const CScript dest,
int64_t  nCreateTime 
)

Definition at line 970 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ AddWatchOnlyWithDB() [1/2]

bool wallet::LegacyScriptPubKeyMan::AddWatchOnlyWithDB ( WalletBatch batch,
const CScript dest 
)
private

Definition at line 944 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnlyWithDB() [2/2]

bool wallet::LegacyScriptPubKeyMan::AddWatchOnlyWithDB ( WalletBatch batch,
const CScript dest,
int64_t  create_time 
)
private

Adds a watch-only address to the store, and saves it to disk.

Definition at line 958 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ CanGenerateKeys()

bool wallet::LegacyScriptPubKeyMan::CanGenerateKeys ( ) const

Definition at line 1203 of file scriptpubkeyman.cpp.

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

◆ CanGetAddresses()

bool wallet::LegacyScriptPubKeyMan::CanGetAddresses ( bool  internal = false) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 458 of file scriptpubkeyman.cpp.

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

◆ CanProvide()

bool wallet::LegacyScriptPubKeyMan::CanProvide ( const CScript script,
SignatureData sigdata 
)
overridevirtual

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

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 594 of file scriptpubkeyman.cpp.

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

◆ DeriveNewChildKey()

void wallet::LegacyScriptPubKeyMan::DeriveNewChildKey ( WalletBatch batch,
CKeyMetadata metadata,
CKey secret,
CHDChain hd_chain,
bool  internal = false 
)
private

Definition at line 1127 of file scriptpubkeyman.cpp.

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

◆ DeriveNewSeed()

CPubKey wallet::LegacyScriptPubKeyMan::DeriveNewSeed ( const CKey key)

Definition at line 1217 of file scriptpubkeyman.cpp.

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

◆ Encrypt()

bool wallet::LegacyScriptPubKeyMan::Encrypt ( const CKeyingMaterial master_key,
WalletBatch batch 
)
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 275 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ FillPSBT()

std::optional< PSBTError > wallet::LegacyScriptPubKeyMan::FillPSBT ( PartiallySignedTransaction psbt,
const PrecomputedTransactionData txdata,
int  sighash_type = SIGHASH_DEFAULT,
bool  sign = true,
bool  bip32derivs = false,
int *  n_signed = nullptr,
bool  finalize = true 
) const
overridevirtual

Adds script and derivation path information to a PSBT, and optionally signs it.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 635 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GenerateNewKey()

CPubKey wallet::LegacyScriptPubKeyMan::GenerateNewKey ( WalletBatch batch,
CHDChain hd_chain,
bool  internal = false 
)

Generate a new key.

Definition at line 1083 of file scriptpubkeyman.cpp.

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

◆ GenerateNewSeed()

CPubKey wallet::LegacyScriptPubKeyMan::GenerateNewSeed ( )

Definition at line 1210 of file scriptpubkeyman.cpp.

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

◆ GetAllReserveKeys()

const std::map< CKeyID, int64_t > & wallet::LegacyScriptPubKeyMan::GetAllReserveKeys ( ) const
inline

Definition at line 563 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ GetID()

uint256 wallet::LegacyScriptPubKeyMan::GetID ( ) const
overridevirtual

Reimplemented from wallet::LegacyDataSPKM.

Definition at line 702 of file scriptpubkeyman.cpp.

◆ GetKeyFromPool()

bool wallet::LegacyScriptPubKeyMan::GetKeyFromPool ( CPubKey key,
const OutputType  type 
)
private

Fetches a key from the keypool.

Definition at line 1424 of file scriptpubkeyman.cpp.

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

◆ GetKeyPoolSize()

unsigned int wallet::LegacyScriptPubKeyMan::GetKeyPoolSize ( ) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 577 of file scriptpubkeyman.cpp.

◆ GetKeys()

std::set< CKeyID > wallet::LegacyScriptPubKeyMan::GetKeys ( ) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 1690 of file scriptpubkeyman.cpp.

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

◆ GetMetadata()

std::unique_ptr< CKeyMetadata > wallet::LegacyScriptPubKeyMan::GetMetadata ( const CTxDestination dest) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 681 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetNewDestination()

util::Result< CTxDestination > wallet::LegacyScriptPubKeyMan::GetNewDestination ( const OutputType  type)
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 31 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetOldestKeyPoolTime()

std::optional< int64_t > wallet::LegacyScriptPubKeyMan::GetOldestKeyPoolTime ( ) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 553 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetReservedDestination()

util::Result< CTxDestination > wallet::LegacyScriptPubKeyMan::GetReservedDestination ( const OutputType  type,
bool  internal,
int64_t &  index,
CKeyPool keypool 
)
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 305 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetTimeFirstKey()

int64_t wallet::LegacyScriptPubKeyMan::GetTimeFirstKey ( ) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 583 of file scriptpubkeyman.cpp.

◆ GUARDED_BY() [1/3]

WalletBatch *encrypted_batch wallet::LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
privatevirtual

◆ GUARDED_BY() [2/3]

int64_t nTimeFirstKey wallet::LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
privatevirtual

◆ GUARDED_BY() [3/3]

int64_t m_keypool_size wallet::LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
inlineprivatevirtual

Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments)

Implements wallet::LegacyDataSPKM.

Definition at line 384 of file scriptpubkeyman.h.

◆ HavePrivateKeys()

bool wallet::LegacyScriptPubKeyMan::HavePrivateKeys ( ) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 522 of file scriptpubkeyman.cpp.

◆ ImportPrivKeys()

bool wallet::LegacyScriptPubKeyMan::ImportPrivKeys ( const std::map< CKeyID, CKey > &  privkey_map,
const int64_t  timestamp 
)

Definition at line 1622 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ ImportPubKeys()

bool wallet::LegacyScriptPubKeyMan::ImportPubKeys ( const std::vector< std::pair< CKeyID, bool > > &  ordered_pubkeys,
const std::map< CKeyID, CPubKey > &  pubkey_map,
const std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo > > &  key_origins,
const bool  add_keypool,
const int64_t  timestamp 
)

Definition at line 1645 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ ImportScriptPubKeys()

bool wallet::LegacyScriptPubKeyMan::ImportScriptPubKeys ( const std::set< CScript > &  script_pub_keys,
const bool  have_solving_data,
const int64_t  timestamp 
)

Definition at line 1677 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ ImportScripts()

bool wallet::LegacyScriptPubKeyMan::ImportScripts ( const std::set< CScript scripts,
int64_t  timestamp 
)

Definition at line 1598 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ IsHDEnabled()

bool wallet::LegacyScriptPubKeyMan::IsHDEnabled ( ) const
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 453 of file scriptpubkeyman.cpp.

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

◆ KeepDestination()

void wallet::LegacyScriptPubKeyMan::KeepDestination ( int64_t  index,
const OutputType type 
)
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 1390 of file scriptpubkeyman.cpp.

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

◆ KeypoolCountExternalKeys()

size_t wallet::LegacyScriptPubKeyMan::KeypoolCountExternalKeys ( ) const

Definition at line 571 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ LearnAllRelatedScripts()

void wallet::LegacyScriptPubKeyMan::LearnAllRelatedScripts ( const CPubKey key)

Same as LearnRelatedScripts, but when the OutputType is not known (and could be anything).

Definition at line 1506 of file scriptpubkeyman.cpp.

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

◆ LearnRelatedScripts()

void wallet::LegacyScriptPubKeyMan::LearnRelatedScripts ( const CPubKey key,
OutputType  type 
)

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 software, as FillableSigningProvider automatically does this implicitly for all keys now.

Definition at line 1493 of file scriptpubkeyman.cpp.

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

◆ LoadKeyMetadata()

void wallet::LegacyScriptPubKeyMan::LoadKeyMetadata ( const CKeyID keyID,
const CKeyMetadata metadata 
)
overridevirtual

Load metadata (used by LoadWallet)

Reimplemented from wallet::LegacyDataSPKM.

Definition at line 798 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ LoadScriptMetadata()

void wallet::LegacyScriptPubKeyMan::LoadScriptMetadata ( const CScriptID script_id,
const CKeyMetadata metadata 
)
overridevirtual

Reimplemented from wallet::LegacyDataSPKM.

Definition at line 811 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ MarkPreSplitKeys()

void wallet::LegacyScriptPubKeyMan::MarkPreSplitKeys ( )

Definition at line 1553 of file scriptpubkeyman.cpp.

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

◆ MarkReserveKeysAsUsed()

std::vector< CKeyPool > wallet::LegacyScriptPubKeyMan::MarkReserveKeysAsUsed ( int64_t  keypool_id)

Marks all keys in the keypool up to and including the provided key as used.

Parameters
keypool_iddetermines the last key to mark as used
Returns
All affected keys

Definition at line 1512 of file scriptpubkeyman.cpp.

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

◆ MarkUnusedAddresses()

std::vector< WalletDestination > wallet::LegacyScriptPubKeyMan::MarkUnusedAddresses ( const CScript script)
overridevirtual

Mark unused addresses as being used Affects all keys up to and including the one determined by provided script.

Parameters
scriptdetermines the last key to mark as used
Returns
All of the addresses affected

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 349 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ NewKeyPool()

bool wallet::LegacyScriptPubKeyMan::NewKeyPool ( )

Mark old keypool keys as used, and generate all new keys.

Definition at line 1264 of file scriptpubkeyman.cpp.

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

◆ RemoveWatchOnly()

bool wallet::LegacyScriptPubKeyMan::RemoveWatchOnly ( const CScript dest)

Remove a watch only script from the keystore.

Definition at line 906 of file scriptpubkeyman.cpp.

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

◆ ReserveKeyFromKeyPool()

bool wallet::LegacyScriptPubKeyMan::ReserveKeyFromKeyPool ( int64_t &  nIndex,
CKeyPool keypool,
bool  fRequestedInternal 
)
private

Reserves a key from the keypool and sets nIndex to its index.

Parameters
[out]nIndexthe index of the key in keypool
[out]keypoolthe keypool the key was drawn from, which could be the the pre-split pool if present, or the internal or external pool
fRequestedInternaltrue if the caller would like the key drawn from the internal keypool, false if external is preferred
Returns
true if succeeded, false if failed due to empty keypool
Exceptions
std::runtime_errorif keypool read failed, key was invalid, was not found in the wallet, or was misclassified in the internal or external keypool

Definition at line 1447 of file scriptpubkeyman.cpp.

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

◆ ReturnDestination()

void wallet::LegacyScriptPubKeyMan::ReturnDestination ( int64_t  index,
bool  internal,
const CTxDestination  
)
overridevirtual

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 1404 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ RewriteDB()

void wallet::LegacyScriptPubKeyMan::RewriteDB ( )
overridevirtual

The action to do when the DB needs rewrite.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 528 of file scriptpubkeyman.cpp.

◆ SetHDSeed()

void wallet::LegacyScriptPubKeyMan::SetHDSeed ( const CPubKey key)

Definition at line 1245 of file scriptpubkeyman.cpp.

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

◆ SetupGeneration()

bool wallet::LegacyScriptPubKeyMan::SetupGeneration ( bool  force = false)
overridevirtual

Sets up the key generation stuff, i.e.

generates new HD seeds and sets them as active. Returns false if already setup or setup fails, true if setup is successful Set force=true to make it re-setup if already setup, used for upgrades

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 440 of file scriptpubkeyman.cpp.

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

◆ SignMessage()

SigningResult wallet::LegacyScriptPubKeyMan::SignMessage ( const std::string &  message,
const PKHash pkhash,
std::string &  str_sig 
) const
overridevirtual

Sign a message with the given script.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 622 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ SignTransaction()

bool wallet::LegacyScriptPubKeyMan::SignTransaction ( CMutableTransaction tx,
const std::map< COutPoint, Coin > &  coins,
int  sighash,
std::map< int, bilingual_str > &  input_errors 
) const
overridevirtual

Creates new signatures and adds them to the transaction.

Returns whether all inputs were signed

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 617 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ TopUp()

bool wallet::LegacyScriptPubKeyMan::TopUp ( unsigned int  size = 0)
overridevirtual

Fills internal address pool.

Use within ScriptPubKeyMan implementations should be used sparingly and only when something from the address pool is removed, excluding GetNewDestination and GetReservedDestination. External wallet code is primarily responsible for topping up prior to fetching new addresses

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 1298 of file scriptpubkeyman.cpp.

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

◆ TopUpChain()

bool wallet::LegacyScriptPubKeyMan::TopUpChain ( WalletBatch batch,
CHDChain chain,
unsigned int  size 
)
private

Definition at line 1322 of file scriptpubkeyman.cpp.

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

◆ TopUpInactiveHDChain()

bool wallet::LegacyScriptPubKeyMan::TopUpInactiveHDChain ( const CKeyID  seed_id,
int64_t  index,
bool  internal 
)
private

Like TopUp() but adds keys for inactive HD chains.

Ensures that there are at least -keypool number of keys derived after the given index.

Parameters
seed_idthe CKeyID for the HD seed.
indexthe index to start generating keys from
internalwhether the internal chain should be used. true for internal chain, false for external chain.
Returns
true if seed was found and keys were derived. false if unable to derive seeds

Definition at line 326 of file scriptpubkeyman.cpp.

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

◆ UpdateTimeFirstKey()

void wallet::LegacyScriptPubKeyMan::UpdateTimeFirstKey ( int64_t  nCreateTime)

Update wallet first key creation time.

This should be called whenever keys are added to the wallet, with the oldest key creation time.

Definition at line 711 of file scriptpubkeyman.cpp.

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

◆ Upgrade()

bool wallet::LegacyScriptPubKeyMan::Upgrade ( int  prev_version,
int  new_version,
bilingual_str error 
)
overridevirtual

Upgrades the wallet to the specified version.

Reimplemented from wallet::ScriptPubKeyMan.

Definition at line 475 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ UpgradeKeyMetadata()

void wallet::LegacyScriptPubKeyMan::UpgradeKeyMetadata ( )

Upgrade stored CKeyMetadata objects to store key origin info as KeyOriginInfo.

Definition at line 405 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ m_index_to_reserved_key

std::map<int64_t, CKeyID> wallet::LegacyScriptPubKeyMan::m_index_to_reserved_key
private

Definition at line 417 of file scriptpubkeyman.h.


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