Bitcoin Core  22.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | Protected Attributes | List of all members
wallet::ScriptPubKeyMan Class Reference

#include <scriptpubkeyman.h>

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

Public Member Functions

 ScriptPubKeyMan (WalletStorage &storage)
 
virtual ~ScriptPubKeyMan ()
 
virtual bool GetNewDestination (const OutputType type, CTxDestination &dest, bilingual_str &error)
 
virtual isminetype IsMine (const CScript &script) const
 
virtual bool CheckDecryptionKey (const CKeyingMaterial &master_key, bool accept_no_keys=false)
 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 bool GetReservedDestination (const OutputType type, bool internal, CTxDestination &address, int64_t &index, CKeyPool &keypool, bilingual_str &error)
 
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 TransactionError 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
 
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 Attributes

boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
 Watch-only address added. More...
 
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
 Keypool has new keys. More...
 

Protected Attributes

WalletStoragem_storage
 

Detailed Description

Definition at line 166 of file scriptpubkeyman.h.

Constructor & Destructor Documentation

◆ ScriptPubKeyMan()

wallet::ScriptPubKeyMan::ScriptPubKeyMan ( WalletStorage storage)
inlineexplicit

Definition at line 172 of file scriptpubkeyman.h.

◆ ~ScriptPubKeyMan()

virtual wallet::ScriptPubKeyMan::~ScriptPubKeyMan ( )
inlinevirtual

Definition at line 173 of file scriptpubkeyman.h.

Member Function Documentation

◆ CanGetAddresses()

virtual bool wallet::ScriptPubKeyMan::CanGetAddresses ( bool  internal = false) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 210 of file scriptpubkeyman.h.

◆ CanProvide()

virtual bool wallet::ScriptPubKeyMan::CanProvide ( const CScript script,
SignatureData sigdata 
)
inlinevirtual

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

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 233 of file scriptpubkeyman.h.

◆ CheckDecryptionKey()

virtual bool wallet::ScriptPubKeyMan::CheckDecryptionKey ( const CKeyingMaterial master_key,
bool  accept_no_keys = false 
)
inlinevirtual

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

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 178 of file scriptpubkeyman.h.

◆ Encrypt()

virtual bool wallet::ScriptPubKeyMan::Encrypt ( const CKeyingMaterial master_key,
WalletBatch batch 
)
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 179 of file scriptpubkeyman.h.

◆ FillPSBT()

virtual TransactionError wallet::ScriptPubKeyMan::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
inlinevirtual

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

Reimplemented in wallet::DescriptorScriptPubKeyMan, wallet::LegacyScriptPubKeyMan, and wallet::ExternalSignerScriptPubKeyMan.

Definition at line 240 of file scriptpubkeyman.h.

◆ GetID()

virtual uint256 wallet::ScriptPubKeyMan::GetID ( ) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 242 of file scriptpubkeyman.h.

◆ GetKeyPoolSize()

virtual unsigned int wallet::ScriptPubKeyMan::GetKeyPoolSize ( ) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 222 of file scriptpubkeyman.h.

◆ GetMetadata()

virtual std::unique_ptr<CKeyMetadata> wallet::ScriptPubKeyMan::GetMetadata ( const CTxDestination dest) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 226 of file scriptpubkeyman.h.

◆ GetNewDestination()

virtual bool wallet::ScriptPubKeyMan::GetNewDestination ( const OutputType  type,
CTxDestination dest,
bilingual_str error 
)
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 174 of file scriptpubkeyman.h.

◆ GetOldestKeyPoolTime()

virtual std::optional<int64_t> wallet::ScriptPubKeyMan::GetOldestKeyPoolTime ( ) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 220 of file scriptpubkeyman.h.

Here is the call graph for this function:

◆ GetReservedDestination()

virtual bool wallet::ScriptPubKeyMan::GetReservedDestination ( const OutputType  type,
bool  internal,
CTxDestination address,
int64_t &  index,
CKeyPool keypool,
bilingual_str error 
)
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 181 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ GetSolvingProvider()

virtual std::unique_ptr<SigningProvider> wallet::ScriptPubKeyMan::GetSolvingProvider ( const CScript script) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 228 of file scriptpubkeyman.h.

◆ GetTimeFirstKey()

virtual int64_t wallet::ScriptPubKeyMan::GetTimeFirstKey ( ) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 224 of file scriptpubkeyman.h.

◆ HavePrivateKeys()

virtual bool wallet::ScriptPubKeyMan::HavePrivateKeys ( ) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 215 of file scriptpubkeyman.h.

◆ IsHDEnabled()

virtual bool wallet::ScriptPubKeyMan::IsHDEnabled ( ) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 207 of file scriptpubkeyman.h.

◆ IsMine()

virtual isminetype wallet::ScriptPubKeyMan::IsMine ( const CScript script) const
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 175 of file scriptpubkeyman.h.

◆ KeepDestination()

virtual void wallet::ScriptPubKeyMan::KeepDestination ( int64_t  index,
const OutputType type 
)
inlinevirtual

Reimplemented in wallet::LegacyScriptPubKeyMan.

Definition at line 182 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ MarkUnusedAddresses()

virtual std::vector<WalletDestination> wallet::ScriptPubKeyMan::MarkUnusedAddresses ( const CScript script)
inlinevirtual

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 in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 198 of file scriptpubkeyman.h.

◆ ReturnDestination()

virtual void wallet::ScriptPubKeyMan::ReturnDestination ( int64_t  index,
bool  internal,
const CTxDestination addr 
)
inlinevirtual

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 183 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ RewriteDB()

virtual void wallet::ScriptPubKeyMan::RewriteDB ( )
inlinevirtual

The action to do when the DB needs rewrite.

Reimplemented in wallet::LegacyScriptPubKeyMan.

Definition at line 218 of file scriptpubkeyman.h.

◆ SetupGeneration()

virtual bool wallet::ScriptPubKeyMan::SetupGeneration ( bool  force = false)
inlinevirtual

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 in wallet::LegacyScriptPubKeyMan.

Definition at line 204 of file scriptpubkeyman.h.

◆ SignMessage()

virtual SigningResult wallet::ScriptPubKeyMan::SignMessage ( const std::string &  message,
const PKHash pkhash,
std::string &  str_sig 
) const
inlinevirtual

Sign a message with the given script.

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 238 of file scriptpubkeyman.h.

◆ SignTransaction()

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

Creates new signatures and adds them to the transaction.

Returns whether all inputs were signed

Reimplemented in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 236 of file scriptpubkeyman.h.

◆ TopUp()

virtual bool wallet::ScriptPubKeyMan::TopUp ( unsigned int  size = 0)
inlinevirtual

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 in wallet::DescriptorScriptPubKeyMan, and wallet::LegacyScriptPubKeyMan.

Definition at line 189 of file scriptpubkeyman.h.

Here is the caller graph for this function:

◆ Upgrade()

virtual bool wallet::ScriptPubKeyMan::Upgrade ( int  prev_version,
int  new_version,
bilingual_str error 
)
inlinevirtual

Upgrades the wallet to the specified version.

Reimplemented in wallet::LegacyScriptPubKeyMan.

Definition at line 213 of file scriptpubkeyman.h.

◆ WalletLogPrintf()

template<typename... Params>
void wallet::ScriptPubKeyMan::WalletLogPrintf ( std::string  fmt,
Params...  parameters 
) const
inline

Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.

Definition at line 246 of file scriptpubkeyman.h.

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

Member Data Documentation

◆ m_storage

WalletStorage& wallet::ScriptPubKeyMan::m_storage
protected

Definition at line 169 of file scriptpubkeyman.h.

◆ NotifyCanGetAddressesChanged

boost::signals2::signal<void ()> wallet::ScriptPubKeyMan::NotifyCanGetAddressesChanged

Keypool has new keys.

Definition at line 254 of file scriptpubkeyman.h.

◆ NotifyWatchonlyChanged

boost::signals2::signal<void (bool fHaveWatchOnly)> wallet::ScriptPubKeyMan::NotifyWatchonlyChanged

Watch-only address added.

Definition at line 248 of file scriptpubkeyman.h.


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