Bitcoin Core  0.20.99
P2P Digital Currency
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
LegacyScriptPubKeyMan Class Referenceabstract

#include <scriptpubkeyman.h>

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

Public Member Functions

bool GetNewDestination (const OutputType type, CTxDestination &dest, std::string &error) override
 
isminetype IsMine (const CScript &script) const override
 
bool CheckDecryptionKey (const CKeyingMaterial &master_key, bool accept_no_keys=false) override
 Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the keys handled by it. More...
 
bool Encrypt (const CKeyingMaterial &master_key, WalletBatch *batch) override
 
bool GetReservedDestination (const OutputType type, bool internal, CTxDestination &address, 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...
 
void MarkUnusedAddresses (const CScript &script) override
 Mark unused addresses as being used. 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, 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...
 
int64_t GetOldestKeyPoolTime () const override
 
size_t KeypoolCountExternalKeys () const override
 
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
 
std::unique_ptr< SigningProviderGetSolvingProvider (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. More...
 
bool SignTransaction (CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, std::string > &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...
 
TransactionError FillPSBT (PartiallySignedTransaction &psbt, int sighash_type=1, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr) const override
 Adds script and derivation path information to a PSBT, and optionally signs it. More...
 
uint256 GetID () const override
 
void SetInternal (bool internal) override
 
std::map< CKeyID, CKeyMetadata > mapKeyMetadata GUARDED_BY (cs_KeyStore)
 
std::map< CScriptID, CKeyMetadata > m_script_metadata GUARDED_BY (cs_KeyStore)
 
bool AddKeyPubKey (const CKey &key, const CPubKey &pubkey) override
 Adds a key to the store, and saves it to disk. 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 AddCryptedKey (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
 Adds an encrypted key to the store, and saves it to disk. 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...
 
void UpdateTimeFirstKey (int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Update wallet first key creation time. More...
 
bool LoadCScript (const CScript &redeemScript)
 Adds a CScript to the store. More...
 
void LoadKeyMetadata (const CKeyID &keyID, const CKeyMetadata &metadata)
 Load metadata (used by LoadWallet) More...
 
void LoadScriptMetadata (const CScriptID &script_id, const CKeyMetadata &metadata)
 
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)
 
void LoadHDChain (const CHDChain &chain)
 Load a HD chain model (used by LoadWallet) More...
 
const CHDChainGetHDChain () const
 
void AddInactiveHDChain (const CHDChain &chain)
 
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 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 GetWatchPubKey (const CKeyID &address, CPubKey &pubkey_out) const
 Fetches a pubkey from mapWatchKeys if it exists there. More...
 
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 AddCScript (const CScript &redeemScript) override
 
bool GetKeyOrigin (const CKeyID &keyid, KeyOriginInfo &info) const override
 
void LoadKeyPool (int64_t nIndex, const CKeyPool &keypool)
 Load a keypool entry. More...
 
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< CKeyID > &ordered_pubkeys, const std::map< CKeyID, CPubKey > &pubkey_map, const std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo >> &key_origins, const bool add_keypool, const bool internal, 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...
 
void MarkReserveKeysAsUsed (int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
 Marks all keys in the keypool up to and including reserve_key as used. More...
 
const std::map< CKeyID, int64_t > & GetAllReserveKeys () const
 
std::set< CKeyIDGetKeys () const override
 
- Public Member Functions inherited from ScriptPubKeyMan
 ScriptPubKeyMan (WalletStorage &storage)
 
virtual ~ScriptPubKeyMan ()
 
template<typename... Params>
void WalletLogPrintf (std::string fmt, Params... parameters) 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 AddKey (const CKey &key)
 
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 ()
 

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

WalletBatch *encrypted_batch GUARDED_BY (cs_KeyStore)
 
CryptedKeyMap mapCryptedKeys GUARDED_BY (cs_KeyStore)
 
WatchOnlySet setWatchOnly GUARDED_BY (cs_KeyStore)
 
WatchKeyMap mapWatchKeys GUARDED_BY (cs_KeyStore)
 
int64_t nTimeFirstKey GUARDED_BY (cs_KeyStore)=0
 
bool AddKeyPubKeyInner (const CKey &key, const CPubKey &pubkey)
 
bool AddCryptedKeyInner (const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
 
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 AddWatchOnlyInMem (const CScript &dest)
 
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)
 
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
 
bool GetKeyFromPool (CPubKey &key, const OutputType type, bool internal=false)
 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...
 

Private Attributes

bool fDecryptionThoroughlyChecked = true
 keeps track of whether Unlock has run a thorough check before More...
 
CHDChain m_hd_chain
 
std::unordered_map< CKeyID, CHDChain, KeyIDHasherm_inactive_hd_chains
 
std::map< CKeyID, int64_t > m_pool_key_to_index
 
std::map< int64_t, CKeyIDm_index_to_reserved_key
 

Additional Inherited Members

- Public Attributes inherited from ScriptPubKeyMan
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
 Watch-only address added. More...
 
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
 Keypool has new keys. More...
 
- 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. 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 ScriptPubKeyMan
WalletStoragem_storage
 

Detailed Description

Definition at line 256 of file scriptpubkeyman.h.

Member Typedef Documentation

◆ CryptedKeyMap

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

Definition at line 267 of file scriptpubkeyman.h.

◆ WatchKeyMap

Definition at line 263 of file scriptpubkeyman.h.

◆ WatchOnlySet

using LegacyScriptPubKeyMan::WatchOnlySet = std::set<CScript>
private

Definition at line 262 of file scriptpubkeyman.h.

Member Function Documentation

◆ AddCryptedKey()

bool 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 802 of file scriptpubkeyman.cpp.

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

◆ AddCryptedKeyInner()

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

Definition at line 792 of file scriptpubkeyman.cpp.

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

◆ AddCScript()

bool LegacyScriptPubKeyMan::AddCScript ( const CScript redeemScript)
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 1456 of file scriptpubkeyman.cpp.

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

◆ AddCScriptWithDB()

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

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

Definition at line 1462 of file scriptpubkeyman.cpp.

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

◆ AddHDChain()

void LegacyScriptPubKeyMan::AddHDChain ( const CHDChain chain)

Definition at line 915 of file scriptpubkeyman.cpp.

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

◆ AddInactiveHDChain()

void LegacyScriptPubKeyMan::AddInactiveHDChain ( const CHDChain chain)

Definition at line 930 of file scriptpubkeyman.cpp.

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

◆ AddKeyOriginWithDB()

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

Add a KeyOriginInfo to the wallet.

Definition at line 1473 of file scriptpubkeyman.cpp.

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

◆ AddKeypoolPubkeyWithDB()

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

Definition at line 1268 of file scriptpubkeyman.cpp.

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

◆ AddKeyPubKey()

bool 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 683 of file scriptpubkeyman.cpp.

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

◆ AddKeyPubKeyInner()

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

Definition at line 759 of file scriptpubkeyman.cpp.

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

◆ AddKeyPubKeyWithDB()

bool 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 690 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnly() [1/2]

bool 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 897 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnly() [2/2]

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

Definition at line 903 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ AddWatchOnlyInMem()

bool LegacyScriptPubKeyMan::AddWatchOnlyInMem ( const CScript dest)
private

Definition at line 865 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnlyWithDB() [1/2]

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

Definition at line 877 of file scriptpubkeyman.cpp.

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

◆ AddWatchOnlyWithDB() [2/2]

bool 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 891 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ CanGenerateKeys()

bool LegacyScriptPubKeyMan::CanGenerateKeys ( ) const

Definition at line 1126 of file scriptpubkeyman.cpp.

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

◆ CanGetAddresses()

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

Reimplemented from ScriptPubKeyMan.

Definition at line 424 of file scriptpubkeyman.cpp.

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

◆ CanProvide()

bool 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 ScriptPubKeyMan.

Definition at line 547 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ CheckDecryptionKey()

bool LegacyScriptPubKeyMan::CheckDecryptionKey ( const CKeyingMaterial master_key,
bool  accept_no_keys = false 
)
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 ScriptPubKeyMan.

Definition at line 218 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ DeriveNewChildKey()

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

Definition at line 1050 of file scriptpubkeyman.cpp.

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

◆ DeriveNewSeed()

CPubKey LegacyScriptPubKeyMan::DeriveNewSeed ( const CKey key)

Definition at line 1141 of file scriptpubkeyman.cpp.

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

◆ Encrypt()

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

Reimplemented from ScriptPubKeyMan.

Definition at line 258 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ FillPSBT()

TransactionError LegacyScriptPubKeyMan::FillPSBT ( PartiallySignedTransaction psbt,
int  sighash_type = 1,
bool  sign = true,
bool  bip32derivs = false,
int *  n_signed = nullptr 
) const
overridevirtual

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

Reimplemented from ScriptPubKeyMan.

Definition at line 588 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GenerateNewKey()

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

Generate a new key.

Definition at line 1013 of file scriptpubkeyman.cpp.

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

◆ GenerateNewSeed()

CPubKey LegacyScriptPubKeyMan::GenerateNewSeed ( )

Definition at line 1133 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>& LegacyScriptPubKeyMan::GetAllReserveKeys ( ) const
inline

Definition at line 495 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ GetHDChain()

const CHDChain& LegacyScriptPubKeyMan::GetHDChain ( ) const
inline

Definition at line 429 of file scriptpubkeyman.h.

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

◆ GetID()

uint256 LegacyScriptPubKeyMan::GetID ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 657 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ GetKey()

bool LegacyScriptPubKeyMan::GetKey ( const CKeyID address,
CKey keyOut 
) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 946 of file scriptpubkeyman.cpp.

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

◆ GetKeyFromPool()

bool LegacyScriptPubKeyMan::GetKeyFromPool ( CPubKey key,
const OutputType  type,
bool  internal = false 
)
private

Fetches a key from the keypool.

Definition at line 1317 of file scriptpubkeyman.cpp.

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

◆ GetKeyOrigin()

bool LegacyScriptPubKeyMan::GetKeyOrigin ( const CKeyID keyid,
KeyOriginInfo info 
) const
overridevirtual

Reimplemented from SigningProvider.

Definition at line 963 of file scriptpubkeyman.cpp.

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

◆ GetKeyPoolSize()

unsigned int LegacyScriptPubKeyMan::GetKeyPoolSize ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 530 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ GetKeys()

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

Reimplemented from FillableSigningProvider.

Definition at line 1575 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 > LegacyScriptPubKeyMan::GetMetadata ( const CTxDestination dest) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 636 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetNewDestination()

bool LegacyScriptPubKeyMan::GetNewDestination ( const OutputType  type,
CTxDestination dest,
std::string &  error 
)
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 18 of file scriptpubkeyman.cpp.

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

◆ GetOldestKeyPoolTime()

int64_t LegacyScriptPubKeyMan::GetOldestKeyPoolTime ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 506 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetPubKey()

bool LegacyScriptPubKeyMan::GetPubKey ( const CKeyID address,
CPubKey vchPubKeyOut 
) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 993 of file scriptpubkeyman.cpp.

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

◆ GetReservedDestination()

bool LegacyScriptPubKeyMan::GetReservedDestination ( const OutputType  type,
bool  internal,
CTxDestination address,
int64_t &  index,
CKeyPool keypool 
)
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 288 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ GetSolvingProvider()

std::unique_ptr< SigningProvider > LegacyScriptPubKeyMan::GetSolvingProvider ( const CScript script) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 542 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ GetTimeFirstKey()

int64_t LegacyScriptPubKeyMan::GetTimeFirstKey ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 536 of file scriptpubkeyman.cpp.

◆ GetWatchPubKey()

bool LegacyScriptPubKeyMan::GetWatchPubKey ( const CKeyID address,
CPubKey pubkey_out 
) const

Fetches a pubkey from mapWatchKeys if it exists there.

Definition at line 982 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY() [1/11]

WalletBatch* encrypted_batch LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [2/11]

CryptedKeyMap mapCryptedKeys LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [3/11]

WatchOnlySet setWatchOnly LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [4/11]

WatchKeyMap mapWatchKeys LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [5/11]

int64_t nTimeFirstKey LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
privatepure virtual

◆ GUARDED_BY() [6/11]

std::set<int64_t> setInternalKeyPool LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [7/11]

std::set<int64_t> setExternalKeyPool LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [8/11]

std::set<int64_t> set_pre_split_keypool LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
private

◆ GUARDED_BY() [9/11]

int64_t m_max_keypool_index LegacyScriptPubKeyMan::GUARDED_BY ( cs_KeyStore  )
privatepure virtual

◆ GUARDED_BY() [10/11]

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

◆ GUARDED_BY() [11/11]

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

◆ HaveKey()

bool LegacyScriptPubKeyMan::HaveKey ( const CKeyID address) const
overridevirtual

Reimplemented from FillableSigningProvider.

Definition at line 937 of file scriptpubkeyman.cpp.

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

◆ HavePrivateKeys()

bool LegacyScriptPubKeyMan::HavePrivateKeys ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 475 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ HaveWatchOnly() [1/2]

bool LegacyScriptPubKeyMan::HaveWatchOnly ( const CScript dest) const

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

Definition at line 820 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ HaveWatchOnly() [2/2]

bool LegacyScriptPubKeyMan::HaveWatchOnly ( ) const

Returns whether there are any watch-only things in the wallet.

Definition at line 826 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ ImportPrivKeys()

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

Definition at line 1507 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ ImportPubKeys()

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

Definition at line 1530 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ ImportScriptPubKeys()

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

Definition at line 1562 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ ImportScripts()

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

Definition at line 1483 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ IsHDEnabled()

bool LegacyScriptPubKeyMan::IsHDEnabled ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 419 of file scriptpubkeyman.cpp.

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

◆ IsMine()

isminetype LegacyScriptPubKeyMan::IsMine ( const CScript script) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 204 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ KeepDestination()

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

Reimplemented from ScriptPubKeyMan.

Definition at line 1284 of file scriptpubkeyman.cpp.

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

◆ KeypoolCountExternalKeys()

size_t LegacyScriptPubKeyMan::KeypoolCountExternalKeys ( ) const
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 524 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ LearnAllRelatedScripts()

void LegacyScriptPubKeyMan::LearnAllRelatedScripts ( const CPubKey key)

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

Definition at line 1396 of file scriptpubkeyman.cpp.

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

◆ LearnRelatedScripts()

void 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 1385 of file scriptpubkeyman.cpp.

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

◆ LoadCryptedKey()

bool LegacyScriptPubKeyMan::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 782 of file scriptpubkeyman.cpp.

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

◆ LoadCScript()

bool LegacyScriptPubKeyMan::LoadCScript ( const CScript redeemScript)

Adds a CScript to the store.

Definition at line 730 of file scriptpubkeyman.cpp.

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

◆ LoadHDChain()

void LegacyScriptPubKeyMan::LoadHDChain ( const CHDChain chain)

Load a HD chain model (used by LoadWallet)

Definition at line 909 of file scriptpubkeyman.cpp.

Here is the caller graph for this function:

◆ LoadKey()

bool LegacyScriptPubKeyMan::LoadKey ( const CKey key,
const CPubKey pubkey 
)

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

Definition at line 678 of file scriptpubkeyman.cpp.

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

◆ LoadKeyMetadata()

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

Load metadata (used by LoadWallet)

Definition at line 745 of file scriptpubkeyman.cpp.

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

◆ LoadKeyPool()

void LegacyScriptPubKeyMan::LoadKeyPool ( int64_t  nIndex,
const CKeyPool keypool 
)

Load a keypool entry.

Definition at line 1105 of file scriptpubkeyman.cpp.

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

◆ LoadScriptMetadata()

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

Definition at line 752 of file scriptpubkeyman.cpp.

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

◆ LoadWatchOnly()

bool LegacyScriptPubKeyMan::LoadWatchOnly ( const CScript dest)

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

Definition at line 860 of file scriptpubkeyman.cpp.

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

◆ MarkPreSplitKeys()

void LegacyScriptPubKeyMan::MarkPreSplitKeys ( )

Definition at line 1438 of file scriptpubkeyman.cpp.

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

◆ MarkReserveKeysAsUsed()

void LegacyScriptPubKeyMan::MarkReserveKeysAsUsed ( int64_t  keypool_id)

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

Definition at line 1402 of file scriptpubkeyman.cpp.

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

◆ MarkUnusedAddresses()

void LegacyScriptPubKeyMan::MarkUnusedAddresses ( const CScript script)
overridevirtual

Mark unused addresses as being used.

Reimplemented from ScriptPubKeyMan.

Definition at line 339 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ NewKeyPool()

bool LegacyScriptPubKeyMan::NewKeyPool ( )

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

Definition at line 1188 of file scriptpubkeyman.cpp.

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

◆ RemoveWatchOnly()

bool LegacyScriptPubKeyMan::RemoveWatchOnly ( const CScript dest)

Remove a watch only script from the keystore.

Definition at line 839 of file scriptpubkeyman.cpp.

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

◆ ReserveKeyFromKeyPool()

bool 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 1339 of file scriptpubkeyman.cpp.

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

◆ ReturnDestination()

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

Reimplemented from ScriptPubKeyMan.

Definition at line 1297 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ RewriteDB()

void LegacyScriptPubKeyMan::RewriteDB ( )
overridevirtual

The action to do when the DB needs rewrite.

Reimplemented from ScriptPubKeyMan.

Definition at line 481 of file scriptpubkeyman.cpp.

◆ SetHDSeed()

void LegacyScriptPubKeyMan::SetHDSeed ( const CPubKey key)

Definition at line 1169 of file scriptpubkeyman.cpp.

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

◆ SetInternal()

void LegacyScriptPubKeyMan::SetInternal ( bool  internal)
overridevirtual

Reimplemented from ScriptPubKeyMan.

Definition at line 1588 of file scriptpubkeyman.cpp.

◆ SetupGeneration()

bool 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 ScriptPubKeyMan.

Definition at line 406 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ SignMessage()

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

Sign a message with the given script.

Reimplemented from ScriptPubKeyMan.

Definition at line 575 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ SignTransaction()

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

Creates new signatures and adds them to the transaction.

Returns whether all inputs were signed

Reimplemented from ScriptPubKeyMan.

Definition at line 570 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ TopUp()

bool 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 ScriptPubKeyMan.

Definition at line 1222 of file scriptpubkeyman.cpp.

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

◆ TopUpInactiveHDChain()

bool 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 302 of file scriptpubkeyman.cpp.

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

◆ UpdateTimeFirstKey()

void 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 666 of file scriptpubkeyman.cpp.

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

◆ Upgrade()

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

Upgrades the wallet to the specified version.

Reimplemented from ScriptPubKeyMan.

Definition at line 441 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

◆ UpgradeKeyMetadata()

void LegacyScriptPubKeyMan::UpgradeKeyMetadata ( )

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

Definition at line 371 of file scriptpubkeyman.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ fDecryptionThoroughlyChecked

bool LegacyScriptPubKeyMan::fDecryptionThoroughlyChecked = true
private

keeps track of whether Unlock has run a thorough check before

Definition at line 260 of file scriptpubkeyman.h.

◆ m_hd_chain

CHDChain LegacyScriptPubKeyMan::m_hd_chain
private

Definition at line 305 of file scriptpubkeyman.h.

◆ m_inactive_hd_chains

std::unordered_map<CKeyID, CHDChain, KeyIDHasher> LegacyScriptPubKeyMan::m_inactive_hd_chains
private

Definition at line 306 of file scriptpubkeyman.h.

◆ m_index_to_reserved_key

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

Definition at line 317 of file scriptpubkeyman.h.

◆ m_pool_key_to_index

std::map<CKeyID, int64_t> LegacyScriptPubKeyMan::m_pool_key_to_index
private

Definition at line 315 of file scriptpubkeyman.h.


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