Bitcoin Core 28.99.0
P2P Digital Currency
|
#include <scriptpubkeyman.h>
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. More... | |
std::unordered_set< CScript, SaltedSipHasher > | GetScriptPubKeys () const override |
Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches. More... | |
std::unique_ptr< SigningProvider > | GetSolvingProvider (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 CHDChain & | GetHDChain () 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, SaltedSipHasher > | 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. More... | |
std::optional< MigrationData > | MigrateToDescriptor () |
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< CTxDestination > | GetNewDestination (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< CTxDestination > | GetReservedDestination (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< WalletDestination > | MarkUnusedAddresses (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 bool | HaveCryptedKeys () 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< CKeyMetadata > | GetMetadata (const CTxDestination &dest) const |
virtual std::unique_ptr< SigningProvider > | GetSolvingProvider (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::PSBTError > | 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 |
Adds script and derivation path information to a PSBT, and optionally signs it. More... | |
virtual uint256 | GetID () const |
virtual std::unordered_set< CScript, SaltedSipHasher > | GetScriptPubKeys () 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< CKeyID > | GetKeys () 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< CScriptID > | GetCScripts () 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 |
Public Attributes | |
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 | |
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 | |
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 | |
CHDChain | m_hd_chain |
std::unordered_map< CKeyID, CHDChain, SaltedSipHasher > | m_inactive_hd_chains |
bool | fDecryptionThoroughlyChecked = true |
keeps track of whether Unlock has run a thorough check before More... | |
Protected Attributes inherited from wallet::ScriptPubKeyMan | |
WalletStorage & | m_storage |
Definition at line 284 of file scriptpubkeyman.h.
|
protected |
Definition at line 289 of file scriptpubkeyman.h.
|
protected |
Definition at line 288 of file scriptpubkeyman.h.
|
protected |
Definition at line 287 of file scriptpubkeyman.h.
|
protected |
Definition at line 865 of file scriptpubkeyman.cpp.
void wallet::LegacyDataSPKM::AddInactiveHDChain | ( | const CHDChain & | chain | ) |
Definition at line 1003 of file scriptpubkeyman.cpp.
|
protectedvirtual |
Reimplemented in wallet::LegacyScriptPubKeyMan.
Definition at line 824 of file scriptpubkeyman.cpp.
|
protected |
Definition at line 938 of file scriptpubkeyman.cpp.
|
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 235 of file scriptpubkeyman.cpp.
bool wallet::LegacyDataSPKM::DeleteRecords | ( | ) |
Delete all the records of this LegacyScriptPubKeyMan from disk.
Definition at line 2044 of file scriptpubkeyman.cpp.
bool wallet::LegacyDataSPKM::DeleteRecordsWithDB | ( | WalletBatch & | batch | ) |
Definition at line 2051 of file scriptpubkeyman.cpp.
|
inline |
|
inlineoverridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Reimplemented in wallet::LegacyScriptPubKeyMan.
Definition at line 319 of file scriptpubkeyman.h.
Reimplemented from FillableSigningProvider.
Definition at line 1019 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from SigningProvider.
Definition at line 1038 of file scriptpubkeyman.cpp.
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 1767 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from FillableSigningProvider.
Definition at line 1069 of file scriptpubkeyman.cpp.
|
overridevirtual |
Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1709 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 595 of file scriptpubkeyman.cpp.
Fetches a pubkey from mapWatchKeys if it exists there.
Definition at line 1058 of file scriptpubkeyman.cpp.
|
protected |
|
protected |
|
protected |
std::map< CKeyID, CKeyMetadata > mapKeyMetadata wallet::LegacyDataSPKM::GUARDED_BY | ( | cs_KeyStore | ) |
std::map< CScriptID, CKeyMetadata > m_script_metadata wallet::LegacyDataSPKM::GUARDED_BY | ( | cs_KeyStore | ) |
std::set< int64_t > setInternalKeyPool wallet::LegacyDataSPKM::GUARDED_BY | ( | cs_KeyStore | ) |
std::set< int64_t > setExternalKeyPool wallet::LegacyDataSPKM::GUARDED_BY | ( | cs_KeyStore | ) |
std::set< int64_t > set_pre_split_keypool wallet::LegacyDataSPKM::GUARDED_BY | ( | cs_KeyStore | ) |
|
pure virtual |
Implemented in wallet::LegacyScriptPubKeyMan, wallet::LegacyScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.
|
overridevirtual |
Reimplemented from FillableSigningProvider.
Definition at line 1010 of file scriptpubkeyman.cpp.
bool wallet::LegacyDataSPKM::HaveWatchOnly | ( | ) | const |
Returns whether there are any watch-only things in the wallet.
Definition at line 899 of file scriptpubkeyman.cpp.
bool wallet::LegacyDataSPKM::HaveWatchOnly | ( | const CScript & | dest | ) | const |
Returns whether the watch-only script is in the wallet.
Definition at line 893 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 221 of file scriptpubkeyman.cpp.
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 855 of file scriptpubkeyman.cpp.
bool wallet::LegacyDataSPKM::LoadCScript | ( | const CScript & | redeemScript | ) |
Adds a CScript to the store.
Definition at line 783 of file scriptpubkeyman.cpp.
void wallet::LegacyDataSPKM::LoadHDChain | ( | const CHDChain & | chain | ) |
Load a HD chain model (used by LoadWallet)
Definition at line 982 of file scriptpubkeyman.cpp.
Adds a key to the store, without saving it to disk (used by LoadWallet)
Definition at line 731 of file scriptpubkeyman.cpp.
|
virtual |
Load metadata (used by LoadWallet)
Reimplemented in wallet::LegacyScriptPubKeyMan.
Definition at line 798 of file scriptpubkeyman.cpp.
void wallet::LegacyDataSPKM::LoadKeyPool | ( | int64_t | nIndex, |
const CKeyPool & | keypool | ||
) |
Load a keypool entry.
Definition at line 1188 of file scriptpubkeyman.cpp.
|
virtual |
Reimplemented in wallet::LegacyScriptPubKeyMan.
Definition at line 811 of file scriptpubkeyman.cpp.
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 933 of file scriptpubkeyman.cpp.
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 1777 of file scriptpubkeyman.cpp.
|
inlineexplicit |
Definition at line 180 of file scriptpubkeyman.h.
|
protected |
keeps track of whether Unlock has run a thorough check before
Definition at line 300 of file scriptpubkeyman.h.
|
protected |
Definition at line 296 of file scriptpubkeyman.h.
|
protected |
Definition at line 297 of file scriptpubkeyman.h.
std::map<CKeyID, int64_t> wallet::LegacyDataSPKM::m_pool_key_to_index |
Definition at line 333 of file scriptpubkeyman.h.