Bitcoin
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
anonymous_namespace{descriptor.cpp}::DescriptorImpl Class Referenceabstract
Inheritance diagram for anonymous_namespace{descriptor.cpp}::DescriptorImpl:
Descriptor anonymous_namespace{descriptor.cpp}::AddressDescriptor anonymous_namespace{descriptor.cpp}::ComboDescriptor anonymous_namespace{descriptor.cpp}::MultisigDescriptor anonymous_namespace{descriptor.cpp}::PKDescriptor anonymous_namespace{descriptor.cpp}::PKHDescriptor anonymous_namespace{descriptor.cpp}::RawDescriptor anonymous_namespace{descriptor.cpp}::SHDescriptor anonymous_namespace{descriptor.cpp}::WPKHDescriptor anonymous_namespace{descriptor.cpp}::WSHDescriptor

Public Member Functions

 DescriptorImpl (std::vector< std::unique_ptr< PubkeyProvider >> pubkeys, std::unique_ptr< DescriptorImpl > script, const std::string &name)
 
bool IsSolvable () const override
 
bool IsRange () const final
 
bool ToStringHelper (const SigningProvider *arg, std::string &out, bool priv) const
 
std::string ToString () const final
 
bool ToPrivateString (const SigningProvider &arg, std::string &out) const override final
 
bool ExpandHelper (int pos, const SigningProvider &arg, Span< const unsigned char > *cache_read, std::vector< CScript > &output_scripts, FlatSigningProvider &out, std::vector< unsigned char > *cache_write) const
 
bool Expand (int pos, const SigningProvider &provider, std::vector< CScript > &output_scripts, FlatSigningProvider &out, std::vector< unsigned char > *cache=nullptr) const final
 
bool ExpandFromCache (int pos, const std::vector< unsigned char > &cache, std::vector< CScript > &output_scripts, FlatSigningProvider &out) const final
 
void ExpandPrivate (int pos, const SigningProvider &provider, FlatSigningProvider &out) const final
 
- Public Member Functions inherited from Descriptor
virtual ~Descriptor ()=default
 

Protected Member Functions

virtual std::string ToStringExtra () const
 Return a serialization of anything except pubkey and script arguments, to be prepended to those. More...
 
virtual std::vector< CScriptMakeScripts (const std::vector< CPubKey > &pubkeys, const CScript *script, FlatSigningProvider &out) const =0
 

Private Attributes

const std::vector< std::unique_ptr< PubkeyProvider > > m_pubkey_args
 Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size of Multisig). More...
 
const std::unique_ptr< DescriptorImplm_script_arg
 The sub-descriptor argument (nullptr for everything but SH and WSH). More...
 
const std::string m_name
 The string name of the descriptor function. More...
 

Detailed Description

Base class for all Descriptor implementations.

Constructor & Destructor Documentation

◆ DescriptorImpl()

anonymous_namespace{descriptor.cpp}::DescriptorImpl::DescriptorImpl ( std::vector< std::unique_ptr< PubkeyProvider >>  pubkeys,
std::unique_ptr< DescriptorImpl script,
const std::string &  name 
)
inline

Member Function Documentation

◆ Expand()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::Expand ( int  pos,
const SigningProvider provider,
std::vector< CScript > &  output_scripts,
FlatSigningProvider out,
std::vector< unsigned char > *  cache = nullptr 
) const
inlinefinalvirtual

Expand a descriptor at a specified position.

pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored. provider: the provider to query for private keys in case of hardened derivation. output_script: the expanded scriptPubKeys will be put here. out: scripts and public keys necessary for solving the expanded scriptPubKeys will be put here (may be equal to provider). cache: vector which will be overwritten with cache data necessary to-evaluate the descriptor at this point without access to private keys.

Implements Descriptor.

◆ ExpandFromCache()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::ExpandFromCache ( int  pos,
const std::vector< unsigned char > &  cache,
std::vector< CScript > &  output_scripts,
FlatSigningProvider out 
) const
inlinefinalvirtual

Expand a descriptor at a specified position using cached expansion data.

pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored. cache: vector from which cached expansion data will be read. output_script: the expanded scriptPubKeys will be put here. out: scripts and public keys necessary for solving the expanded scriptPubKeys will be put here (may be equal to provider).

Implements Descriptor.

◆ ExpandHelper()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::ExpandHelper ( int  pos,
const SigningProvider arg,
Span< const unsigned char > *  cache_read,
std::vector< CScript > &  output_scripts,
FlatSigningProvider out,
std::vector< unsigned char > *  cache_write 
) const
inline

◆ ExpandPrivate()

void anonymous_namespace{descriptor.cpp}::DescriptorImpl::ExpandPrivate ( int  pos,
const SigningProvider provider,
FlatSigningProvider out 
) const
inlinefinalvirtual

Expand the private key for a descriptor at a specified position, if possible.

pos: the position at which to expand the descriptor. If IsRange() is false, this is ignored. provider: the provider to query for the private keys. out: any private keys available for the specified pos will be placed here.

Implements Descriptor.

◆ IsRange()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::IsRange ( ) const
inlinefinalvirtual

Whether the expansion of this descriptor depends on the position.

Implements Descriptor.

◆ IsSolvable()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::IsSolvable ( ) const
inlineoverridevirtual

Whether this descriptor has all information about signing ignoring lack of private keys. This is true for all descriptors except ones that use raw or addr constructions.

Implements Descriptor.

Reimplemented in anonymous_namespace{descriptor.cpp}::RawDescriptor, and anonymous_namespace{descriptor.cpp}::AddressDescriptor.

◆ MakeScripts()

virtual std::vector<CScript> anonymous_namespace{descriptor.cpp}::DescriptorImpl::MakeScripts ( const std::vector< CPubKey > &  pubkeys,
const CScript script,
FlatSigningProvider out 
) const
protectedpure virtual

A helper function to construct the scripts for this descriptor.

This function is invoked once for every CScript produced by evaluating m_script_arg, or just once in case m_script_arg is nullptr.

Parameters
pubkeysThe evaluations of the m_pubkey_args field.
scriptThe evaluation of m_script_arg (or nullptr when m_script_arg is nullptr).
outA FlatSigningProvider to put scripts or public keys in that are necessary to the solver. The script arguments to this function are automatically added, as is the origin info of the provided pubkeys.
Returns
A vector with scriptPubKeys for this descriptor.

Implemented in anonymous_namespace{descriptor.cpp}::WSHDescriptor, anonymous_namespace{descriptor.cpp}::SHDescriptor, anonymous_namespace{descriptor.cpp}::MultisigDescriptor, anonymous_namespace{descriptor.cpp}::ComboDescriptor, anonymous_namespace{descriptor.cpp}::WPKHDescriptor, anonymous_namespace{descriptor.cpp}::PKHDescriptor, anonymous_namespace{descriptor.cpp}::PKDescriptor, anonymous_namespace{descriptor.cpp}::RawDescriptor, and anonymous_namespace{descriptor.cpp}::AddressDescriptor.

◆ ToPrivateString()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::ToPrivateString ( const SigningProvider provider,
std::string &  out 
) const
inlinefinaloverridevirtual

Convert the descriptor to a private string. This fails if the provided provider does not have the relevant private keys.

Implements Descriptor.

◆ ToString()

std::string anonymous_namespace{descriptor.cpp}::DescriptorImpl::ToString ( ) const
inlinefinalvirtual

Convert the descriptor back to a string, undoing parsing.

Implements Descriptor.

◆ ToStringExtra()

virtual std::string anonymous_namespace{descriptor.cpp}::DescriptorImpl::ToStringExtra ( ) const
inlineprotectedvirtual

Return a serialization of anything except pubkey and script arguments, to be prepended to those.

Reimplemented in anonymous_namespace{descriptor.cpp}::MultisigDescriptor, anonymous_namespace{descriptor.cpp}::RawDescriptor, and anonymous_namespace{descriptor.cpp}::AddressDescriptor.

◆ ToStringHelper()

bool anonymous_namespace{descriptor.cpp}::DescriptorImpl::ToStringHelper ( const SigningProvider arg,
std::string &  out,
bool  priv 
) const
inline

Member Data Documentation

◆ m_name

const std::string anonymous_namespace{descriptor.cpp}::DescriptorImpl::m_name
private

The string name of the descriptor function.

◆ m_pubkey_args

const std::vector<std::unique_ptr<PubkeyProvider> > anonymous_namespace{descriptor.cpp}::DescriptorImpl::m_pubkey_args
private

Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size of Multisig).

◆ m_script_arg

const std::unique_ptr<DescriptorImpl> anonymous_namespace{descriptor.cpp}::DescriptorImpl::m_script_arg
private

The sub-descriptor argument (nullptr for everything but SH and WSH).


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