Bitcoin
Classes | Typedefs | Enumerations | Functions
anonymous_namespace{descriptor.cpp} Namespace Reference

Classes

class  AddressDescriptor
 
class  BIP32PubkeyProvider
 
class  ComboDescriptor
 
class  ConstPubkeyProvider
 
class  DescriptorImpl
 
class  MultisigDescriptor
 
class  OriginPubkeyProvider
 
class  PKDescriptor
 
class  PKHDescriptor
 
struct  PubkeyProvider
 
class  RawDescriptor
 
class  SHDescriptor
 
class  WPKHDescriptor
 
class  WSHDescriptor
 

Typedefs

typedef std::vector< uint32_tKeyPath
 

Enumerations

enum  DeriveType { DeriveType::NO, DeriveType::UNHARDENED, DeriveType::HARDENED }
 
enum  ParseScriptContext { ParseScriptContext::TOP, ParseScriptContext::P2SH, ParseScriptContext::P2WSH }
 

Functions

uint64_t PolyMod (uint64_t c, int val)
 
std::string DescriptorChecksum (const Span< const char > &span)
 
std::string AddChecksum (const std::string &str)
 
template<typename T >
std::vector< T > Singleton (T elem)
 
bool Const (const std::string &str, Span< const char > &sp)
 
bool Func (const std::string &str, Span< const char > &sp)
 
Span< const char > Expr (Span< const char > &sp)
 
std::vector< Span< const char > > Split (const Span< const char > &sp, char sep)
 
NODISCARD bool ParseKeyPath (const std::vector< Span< const char >> &split, KeyPath &out)
 
std::unique_ptr< PubkeyProviderParsePubkeyInner (const Span< const char > &sp, bool permit_uncompressed, FlatSigningProvider &out)
 
std::unique_ptr< PubkeyProviderParsePubkey (const Span< const char > &sp, bool permit_uncompressed, FlatSigningProvider &out)
 
std::unique_ptr< DescriptorImplParseScript (Span< const char > &sp, ParseScriptContext ctx, FlatSigningProvider &out)
 
std::unique_ptr< PubkeyProviderInferPubkey (const CPubKey &pubkey, ParseScriptContext, const SigningProvider &provider)
 
std::unique_ptr< DescriptorImplInferScript (const CScript &script, ParseScriptContext ctx, const SigningProvider &provider)
 

Typedef Documentation

◆ KeyPath

typedef std::vector<uint32_t> anonymous_namespace{descriptor.cpp}::KeyPath

Enumeration Type Documentation

◆ DeriveType

enum anonymous_namespace{descriptor.cpp}::DeriveType
strong
Enumerator
NO 
UNHARDENED 
HARDENED 

◆ ParseScriptContext

enum anonymous_namespace{descriptor.cpp}::ParseScriptContext
strong
Enumerator
TOP 
P2SH 
P2WSH 

Function Documentation

◆ AddChecksum()

std::string anonymous_namespace{descriptor.cpp}::AddChecksum ( const std::string &  str)

◆ Const()

bool anonymous_namespace{descriptor.cpp}::Const ( const std::string &  str,
Span< const char > &  sp 
)

Parse a constant. If successful, sp is updated to skip the constant and return true.

◆ DescriptorChecksum()

std::string anonymous_namespace{descriptor.cpp}::DescriptorChecksum ( const Span< const char > &  span)

A character set designed such that:

  • The most common 'unprotected' descriptor characters (hex, keypaths) are in the first group of 32.
  • Case errors cause an offset that's a multiple of 32.
  • As many alphabetic characters are in the same group (while following the above restrictions).

If p(x) gives the position of a character c in this character set, every group of 3 characters (a,b,c) is encoded as the 4 symbols (p(a) & 31, p(b) & 31, p(c) & 31, (p(a) / 32) + 3 * (p(b) / 32) + 9 * (p(c) / 32). This means that changes that only affect the lower 5 bits of the position, or only the higher 2 bits, will just affect a single symbol.

As a result, within-group-of-32 errors count as 1 symbol, as do cross-group errors that don't affect the position within the groups.

The character set for the checksum itself (same as bech32).

◆ Expr()

Span<const char> anonymous_namespace{descriptor.cpp}::Expr ( Span< const char > &  sp)

Return the expression that sp begins with, and update sp to skip it.

◆ Func()

bool anonymous_namespace{descriptor.cpp}::Func ( const std::string &  str,
Span< const char > &  sp 
)

Parse a function call. If successful, sp is updated to be the function's argument(s).

◆ InferPubkey()

std::unique_ptr<PubkeyProvider> anonymous_namespace{descriptor.cpp}::InferPubkey ( const CPubKey pubkey,
ParseScriptContext  ,
const SigningProvider provider 
)

◆ InferScript()

std::unique_ptr<DescriptorImpl> anonymous_namespace{descriptor.cpp}::InferScript ( const CScript script,
ParseScriptContext  ctx,
const SigningProvider provider 
)

◆ ParseKeyPath()

NODISCARD bool anonymous_namespace{descriptor.cpp}::ParseKeyPath ( const std::vector< Span< const char >> &  split,
KeyPath out 
)

Parse a key path, being passed a split list of elements (the first element is ignored).

◆ ParsePubkey()

std::unique_ptr<PubkeyProvider> anonymous_namespace{descriptor.cpp}::ParsePubkey ( const Span< const char > &  sp,
bool  permit_uncompressed,
FlatSigningProvider out 
)

Parse a public key including origin information (if enabled).

◆ ParsePubkeyInner()

std::unique_ptr<PubkeyProvider> anonymous_namespace{descriptor.cpp}::ParsePubkeyInner ( const Span< const char > &  sp,
bool  permit_uncompressed,
FlatSigningProvider out 
)

Parse a public key that excludes origin information.

◆ ParseScript()

std::unique_ptr<DescriptorImpl> anonymous_namespace{descriptor.cpp}::ParseScript ( Span< const char > &  sp,
ParseScriptContext  ctx,
FlatSigningProvider out 
)

Parse a script in a particular context.

◆ PolyMod()

uint64_t anonymous_namespace{descriptor.cpp}::PolyMod ( uint64_t  c,
int  val 
)

◆ Singleton()

template<typename T >
std::vector<T> anonymous_namespace{descriptor.cpp}::Singleton ( elem)

Construct a vector with one element, which is moved into it.

◆ Split()

std::vector<Span<const char> > anonymous_namespace{descriptor.cpp}::Split ( const Span< const char > &  sp,
char  sep 
)

Split a string on every instance of sep, returning a vector.