5 #ifndef BITCOIN_SCRIPT_DESCRIPTOR_H
6 #define BITCOIN_SCRIPT_DESCRIPTOR_H
81 virtual bool IsRange()
const = 0;
88 virtual std::string
ToString()
const = 0;
135 std::unique_ptr<Descriptor>
Parse(
const std::string& descriptor,
FlatSigningProvider& out, std::string&
error,
bool require_checksum =
false);
161 #endif // BITCOIN_SCRIPT_DESCRIPTOR_H
virtual bool IsSingleType() const =0
Whether this descriptor will return one scriptPubKey or multiple (aka is or is not combo) ...
std::unique_ptr< Descriptor > Parse(const std::string &descriptor, FlatSigningProvider &out, std::string &error, bool require_checksum=false)
Parse a descriptor string.
virtual bool IsSolvable() const =0
Whether this descriptor has all information about signing ignoring lack of private keys...
ExtPubKeyMap m_parent_xpubs
Map key expression index -> parent xpub.
virtual bool ExpandFromCache(int pos, const DescriptorCache &read_cache, std::vector< CScript > &output_scripts, FlatSigningProvider &out) const =0
Expand a descriptor at a specified position using cached expansion data.
virtual ~Descriptor()=default
virtual std::string ToString() const =0
Convert the descriptor back to a string, undoing parsing.
virtual void ExpandPrivate(int pos, const SigningProvider &provider, FlatSigningProvider &out) const =0
Expand the private key for a descriptor at a specified position, if possible.
bool error(const char *fmt, const Args &...args)
virtual Optional< OutputType > GetOutputType() const =0
const std::unordered_map< uint32_t, ExtPubKeyMap > GetCachedDerivedExtPubKeys() const
Retrieve all cached derived xpubs.
virtual bool Expand(int pos, const SigningProvider &provider, std::vector< CScript > &output_scripts, FlatSigningProvider &out, DescriptorCache *write_cache=nullptr) const =0
Expand a descriptor at a specified position.
An interface to be implemented by keystores that support signing.
std::string GetDescriptorChecksum(const std::string &descriptor)
Get the checksum for a descriptor.
std::unordered_map< uint32_t, CExtPubKey > ExtPubKeyMap
Cache for single descriptor's derived extended pubkeys.
Serialized script, used inside transaction inputs and outputs.
void CacheParentExtPubKey(uint32_t key_exp_pos, const CExtPubKey &xpub)
Cache a parent xpub.
std::unique_ptr< Descriptor > InferDescriptor(const CScript &script, const SigningProvider &provider)
Find a descriptor for the specified script, using information from provider where possible...
bool GetCachedDerivedExtPubKey(uint32_t key_exp_pos, uint32_t der_index, CExtPubKey &xpub) const
Retrieve a cached xpub derived at an index.
boost::optional< T > Optional
Substitute for C++17 std::optional.
const ExtPubKeyMap GetCachedParentExtPubKeys() const
Retrieve all cached parent xpubs.
virtual bool IsRange() const =0
Whether the expansion of this descriptor depends on the position.
virtual bool ToPrivateString(const SigningProvider &provider, std::string &out) const =0
Convert the descriptor to a private string.
void CacheDerivedExtPubKey(uint32_t key_exp_pos, uint32_t der_index, const CExtPubKey &xpub)
Cache an xpub derived at an index.
std::unordered_map< uint32_t, ExtPubKeyMap > m_derived_xpubs
Map key expression index -> map of (key derivation index -> xpub)
Interface for parsed descriptor objects.
bool GetCachedParentExtPubKey(uint32_t key_exp_pos, CExtPubKey &xpub) const
Retrieve a cached parent xpub.