![]() |
Bitcoin Core 32.99.0
P2P Digital Currency
|
#include <scriptpubkeyman.h>
Public Member Functions | |
| util::Result< CTxDestination > | GetNewDestination (OutputType type) override |
| bool | IsMine (const CScript &script) const override |
| 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. | |
| bool | Encrypt (const CKeyingMaterial &master_key, WalletBatch *batch) override |
| Encrypt keys and write them to a batch with an active transaction. Update in-memory keys only after the transaction commits. | |
| util::Result< CTxDestination > | GetReservedDestination (OutputType type, bool internal, int64_t &index) override |
| void | ReturnDestination (int64_t index, bool internal, const CTxDestination &addr) override |
| bool | TopUp (unsigned int size=0) override |
| Fills internal address pool. | |
| std::vector< WalletDestination > | MarkUnusedAddresses (const CScript &script) override |
| Mark unused addresses as being used Affects all keys up to and including the one determined by provided script. | |
| bool | IsHDEnabled () const override |
| bool | HavePrivateKeys () const override |
| bool | HasPrivKey (const CKeyID &keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| std::optional< CKey > | GetKey (const CKeyID &keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| Retrieve the particular key if it is available. Returns nullopt if the key is not in the wallet, or if the wallet is locked. | |
| bool | HaveCryptedKeys () const override |
| unsigned int | GetKeyPoolSize () const override |
| int64_t | GetTimeFirstKey () const override |
| std::unique_ptr< CKeyMetadata > | GetMetadata (const CTxDestination &dest) const override |
| bool | CanGetAddresses (bool internal=false) const override |
| std::unique_ptr< SigningProvider > | GetSolvingProvider (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. | |
| std::unique_ptr< FlatSigningProvider > | GetSigningProvider (const CPubKey &pubkey) const |
| 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. | |
| SigningResult | SignMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig) const override |
| Sign a message with the given script. | |
| std::optional< common::PSBTError > | FillPSBT (PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, const common::PSBTFillOptions &options, int *n_signed=nullptr) const override |
| Adds script and derivation path information to a PSBT, and optionally signs it. | |
| uint256 | GetID () const override |
| bool | HasWalletDescriptor (const WalletDescriptor &desc) const |
| util::Result< void > | UpdateWalletDescriptor (WalletDescriptor &descriptor, const FlatSigningProvider &provider) |
| bool | CanUpdateToWalletDescriptor (const WalletDescriptor &descriptor, std::string &error) |
| void | WriteDescriptor () |
| WalletDescriptor | GetWalletDescriptor () const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| std::unordered_set< CScript, SaltedSipHasher > | GetScriptPubKeys () const override |
| Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches. | |
| std::unordered_set< CScript, SaltedSipHasher > | GetScriptPubKeys (int32_t minimum_index) const |
| int32_t | GetEndRange () const |
| bool | GetDescriptorString (std::string &out, bool priv) const |
| void | UpgradeDescriptorCache () |
Public Member Functions inherited from wallet::ScriptPubKeyMan | |
| ScriptPubKeyMan (WalletStorage &storage) | |
| virtual | ~ScriptPubKeyMan ()=default |
| virtual void | KeepDestination (int64_t index, const OutputType &type) |
| template<typename... Params> | |
| void | WalletLogPrintf (util::log::FormatString< sizeof...(Params)> wallet_fmt, const Params &... params) const |
| Prepends the wallet name in logging output to ease debugging in multi-wallet use cases. | |
Static Public Member Functions | |
| static std::unique_ptr< DescriptorScriptPubKeyMan > | LoadFromStorage (WalletStorage &storage, const uint256 &id, WalletDescriptor &descriptor, int64_t keypool_size, const KeyMap &keys, const CryptedKeyMap &ckeys) |
| static std::unique_ptr< DescriptorScriptPubKeyMan > | CreateFromImport (WalletStorage &storage, WalletDescriptor &descriptor, int64_t keypool_size, const FlatSigningProvider &provider) |
| static std::unique_ptr< DescriptorScriptPubKeyMan > | CreateFromMigration (WalletStorage &storage, WalletBatch &batch, WalletDescriptor &descriptor, int64_t keypool_size, const FlatSigningProvider &provider) |
| static std::unique_ptr< DescriptorScriptPubKeyMan > | GenerateNewSingleSig (WalletStorage &storage, WalletBatch &batch, int64_t keypool_size, const CExtKey &master_key, OutputType addr_type, bool internal) |
Public Attributes | |
| RecursiveMutex | cs_desc_man |
Public Attributes inherited from wallet::ScriptPubKeyMan | |
| btcsignals::signal< void()> | NotifyCanGetAddressesChanged |
| Keypool has new keys. | |
| btcsignals::signal< void(const ScriptPubKeyMan *spkm, int64_t new_birth_time)> | NotifyFirstKeyTimeChanged |
| Birth time changed. | |
Protected Member Functions | |
| DescriptorScriptPubKeyMan (WalletStorage &storage, const uint256 &id, WalletDescriptor &descriptor, int64_t keypool_size, const KeyMap &keys, const CryptedKeyMap &ckeys) | |
| Create a DescriptorScriptPubKeyMan from existing data (i.e. during loading) | |
| DescriptorScriptPubKeyMan (WalletStorage &storage, WalletDescriptor &descriptor, int64_t keypool_size) | |
| Create a new DescriptorScriptPubKeyMan from a descriptor (e.g. from an import, newly generated) | |
| WalletDescriptor m_wallet_descriptor | GUARDED_BY (cs_desc_man) |
| void | IncIndex () EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| void | DecIndex () EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| void | SetRangeEnd (int32_t end) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| bool | TopUpWithDB (WalletBatch &batch, unsigned int size=0) |
| Same as 'TopUp' but designed for use within a batch transaction context. | |
Private Types | |
| using | ScriptPubKeyMap = std::map< CScript, int32_t > |
| using | PubKeyMap = std::map< CPubKey, int32_t > |
Private Member Functions | |
| ScriptPubKeyMap m_map_script_pub_keys | GUARDED_BY (cs_desc_man) |
| PubKeyMap m_map_pubkeys | GUARDED_BY (cs_desc_man) |
| KeyMap m_map_keys | GUARDED_BY (cs_desc_man) |
| CryptedKeyMap m_map_crypted_keys | GUARDED_BY (cs_desc_man) |
| int64_t m_keypool_size | GUARDED_BY (cs_desc_man) |
| Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments) | |
| bool | AddDescriptorKeyWithDB (WalletBatch &batch, const CKey &key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| KeyMap | GetKeys () const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| std::unique_ptr< FlatSigningProvider > | GetSigningProvider (const CScript &script, bool include_private=false) const |
| std::unique_ptr< FlatSigningProvider > | GetSigningProvider (int32_t index, bool include_private=false) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
| void | Load () |
| void | UpdateWithSigningProvider (WalletBatch &batch, const FlatSigningProvider &signing_provider) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man) |
Private Attributes | |
| int32_t | m_max_cached_index = -1 |
| bool | m_decryption_thoroughly_checked = false |
| keeps track of whether Unlock has run a thorough check before | |
| std::map< uint256, MuSig2SecNonce > | m_musig2_secnonces |
| Map of a session id to MuSig2 secnonce. | |
| const uint256 | m_id |
| std::map< int32_t, FlatSigningProvider > | m_map_signing_providers |
Additional Inherited Members | |
Protected Attributes inherited from wallet::ScriptPubKeyMan | |
| WalletStorage & | m_storage |
Definition at line 273 of file scriptpubkeyman.h.
|
private |
Definition at line 277 of file scriptpubkeyman.h.
|
private |
Definition at line 276 of file scriptpubkeyman.h.
|
protected |
Create a DescriptorScriptPubKeyMan from existing data (i.e. during loading)
Definition at line 850 of file scriptpubkeyman.cpp.
|
inlineprotected |
Create a new DescriptorScriptPubKeyMan from a descriptor (e.g. from an import, newly generated)
Definition at line 327 of file scriptpubkeyman.h.
|
private |
Definition at line 1216 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1259 of file scriptpubkeyman.cpp.
|
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 1363 of file scriptpubkeyman.cpp.
| bool wallet::DescriptorScriptPubKeyMan::CanUpdateToWalletDescriptor | ( | const WalletDescriptor & | descriptor, |
| std::string & | error | ||
| ) |
Definition at line 1675 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 979 of file scriptpubkeyman.cpp.
|
static |
Definition at line 833 of file scriptpubkeyman.cpp.
|
static |
Definition at line 842 of file scriptpubkeyman.cpp.
|
protected |
Definition at line 910 of file scriptpubkeyman.cpp.
|
overridevirtual |
Encrypt keys and write them to a batch with an active transaction. Update in-memory keys only after the transaction commits.
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1011 of file scriptpubkeyman.cpp.
|
overridevirtual |
Adds script and derivation path information to a PSBT, and optionally signs it.
Reimplemented from wallet::ScriptPubKeyMan.
Reimplemented in wallet::ExternalSignerScriptPubKeyMan.
Definition at line 1400 of file scriptpubkeyman.cpp.
|
static |
Definition at line 869 of file scriptpubkeyman.cpp.
| int32_t wallet::DescriptorScriptPubKeyMan::GetEndRange | ( | ) | const |
Definition at line 1588 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1513 of file scriptpubkeyman.cpp.
Retrieve the particular key if it is available. Returns nullopt if the key is not in the wallet, or if the wallet is locked.
Definition at line 1087 of file scriptpubkeyman.cpp.
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1281 of file scriptpubkeyman.cpp.
Definition at line 1062 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1495 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 934 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1044 of file scriptpubkeyman.cpp.
|
overridevirtual |
Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1571 of file scriptpubkeyman.cpp.
| std::unordered_set< CScript, SaltedSipHasher > wallet::DescriptorScriptPubKeyMan::GetScriptPubKeys | ( | int32_t | minimum_index | ) | const |
| std::unique_ptr< FlatSigningProvider > wallet::DescriptorScriptPubKeyMan::GetSigningProvider | ( | const CPubKey & | pubkey | ) | const |
|
private |
Definition at line 1293 of file scriptpubkeyman.cpp.
|
private |
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1358 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1287 of file scriptpubkeyman.cpp.
| WalletDescriptor wallet::DescriptorScriptPubKeyMan::GetWalletDescriptor | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
|
inlineprivate |
Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments)
Definition at line 290 of file scriptpubkeyman.h.
|
protected |
| bool wallet::DescriptorScriptPubKeyMan::HasWalletDescriptor | ( | const WalletDescriptor & | desc | ) | const |
Definition at line 1551 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1275 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1269 of file scriptpubkeyman.cpp.
|
protected |
Definition at line 898 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1253 of file scriptpubkeyman.cpp.
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 973 of file scriptpubkeyman.cpp.
|
private |
Definition at line 1518 of file scriptpubkeyman.cpp.
|
static |
Definition at line 864 of file scriptpubkeyman.cpp.
|
overridevirtual |
Mark unused addresses as being used Affects all keys up to and including the one determined by provided script.
| script | determines the last key to mark as used |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1188 of file scriptpubkeyman.cpp.
|
overridevirtual |
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1052 of file scriptpubkeyman.cpp.
Definition at line 922 of file scriptpubkeyman.cpp.
|
overridevirtual |
Sign a message with the given script.
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1382 of file scriptpubkeyman.cpp.
|
overridevirtual |
Creates new signatures and adds them to the transaction.
Returns whether all inputs were signed
Reimplemented from wallet::ScriptPubKeyMan.
Definition at line 1368 of file scriptpubkeyman.cpp.
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 1111 of file scriptpubkeyman.cpp.
|
protected |
Same as 'TopUp' but designed for use within a batch transaction context.
Definition at line 1120 of file scriptpubkeyman.cpp.
| util::Result< void > wallet::DescriptorScriptPubKeyMan::UpdateWalletDescriptor | ( | WalletDescriptor & | descriptor, |
| const FlatSigningProvider & | provider | ||
| ) |
|
private |
Definition at line 1658 of file scriptpubkeyman.cpp.
| void wallet::DescriptorScriptPubKeyMan::UpgradeDescriptorCache | ( | ) |
Definition at line 1610 of file scriptpubkeyman.cpp.
| void wallet::DescriptorScriptPubKeyMan::WriteDescriptor | ( | ) |
|
mutable |
Definition at line 348 of file scriptpubkeyman.h.
keeps track of whether Unlock has run a thorough check before
Definition at line 287 of file scriptpubkeyman.h.
|
private |
Definition at line 305 of file scriptpubkeyman.h.
|
mutableprivate |
Definition at line 312 of file scriptpubkeyman.h.
|
private |
Definition at line 281 of file scriptpubkeyman.h.
|
mutableprivate |
Map of a session id to MuSig2 secnonce.
Stores MuSig2 secnonces while the MuSig2 signing session is still ongoing. Note that these secnonces must not be reused. In order to avoid being tricked into reusing a nonce, this map is held only in memory and must not be written to disk. The side effect is that signing sessions cannot persist across restarts, but this must be done in order to prevent nonce reuse.
The session id is an arbitrary value set by the signer in order for the signing logic to find ongoing signing sessions, see MuSig2SessionID.
Definition at line 303 of file scriptpubkeyman.h.