Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
MockedDescriptorConverter Class Reference

Converts a mocked descriptor string to a valid one. More...

#include <descriptor.h>

Public Member Functions

bool IdIsCompPubKey (uint8_t idx) const
 
bool IdIsUnCompPubKey (uint8_t idx) const
 
bool IdIsXOnlyPubKey (uint8_t idx) const
 
bool IdIsConstPrivKey (uint8_t idx) const
 
bool IdIsXpub (uint8_t idx) const
 
bool IdIsXprv (uint8_t idx) const
 
void Init ()
 When initializing the target, populate the list of keys. More...
 
std::optional< uint8_t > IdxFromHex (std::string_view hex_characters) const
 Parse an id in the keys vectors from a 2-characters hex string. More...
 
std::optional< std::string > GetDescriptor (std::string_view mocked_desc) const
 Get an actual descriptor string from a descriptor string whose keys were mocked. More...
 

Private Attributes

std::array< std::string, TOTAL_KEYS_GENERATEDkeys_str
 256 keys of various types. More...
 

Static Private Attributes

static constexpr uint8_t KEY_TYPES_COUNT {6}
 Types are raw (un)compressed pubkeys, raw xonly pubkeys, raw privkeys (WIF), xpubs, xprvs. More...
 
static constexpr size_t TOTAL_KEYS_GENERATED {std::numeric_limits<uint8_t>::max() + 1}
 How many keys we'll generate in total. More...
 

Detailed Description

Converts a mocked descriptor string to a valid one.

Every key in a mocked descriptor key is represented by 2 hex characters preceded by the '' character. We parse the two hex characters as an index in a list of pre-generated keys. This list contains keys of the various types accepted in descriptor keys expressions.

Definition at line 21 of file descriptor.h.

Member Function Documentation

◆ GetDescriptor()

std::optional< std::string > MockedDescriptorConverter::GetDescriptor ( std::string_view  mocked_desc) const

Get an actual descriptor string from a descriptor string whose keys were mocked.

Definition at line 51 of file descriptor.cpp.

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

◆ IdIsCompPubKey()

bool MockedDescriptorConverter::IdIsCompPubKey ( uint8_t  idx) const
inline

Definition at line 32 of file descriptor.h.

Here is the caller graph for this function:

◆ IdIsConstPrivKey()

bool MockedDescriptorConverter::IdIsConstPrivKey ( uint8_t  idx) const
inline

Definition at line 35 of file descriptor.h.

Here is the caller graph for this function:

◆ IdIsUnCompPubKey()

bool MockedDescriptorConverter::IdIsUnCompPubKey ( uint8_t  idx) const
inline

Definition at line 33 of file descriptor.h.

Here is the caller graph for this function:

◆ IdIsXOnlyPubKey()

bool MockedDescriptorConverter::IdIsXOnlyPubKey ( uint8_t  idx) const
inline

Definition at line 34 of file descriptor.h.

Here is the caller graph for this function:

◆ IdIsXprv()

bool MockedDescriptorConverter::IdIsXprv ( uint8_t  idx) const
inline

Definition at line 37 of file descriptor.h.

Here is the caller graph for this function:

◆ IdIsXpub()

bool MockedDescriptorConverter::IdIsXpub ( uint8_t  idx) const
inline

Definition at line 36 of file descriptor.h.

◆ IdxFromHex()

std::optional< uint8_t > MockedDescriptorConverter::IdxFromHex ( std::string_view  hex_characters) const

Parse an id in the keys vectors from a 2-characters hex string.

Definition at line 44 of file descriptor.cpp.

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

◆ Init()

void MockedDescriptorConverter::Init ( )

When initializing the target, populate the list of keys.

Definition at line 10 of file descriptor.cpp.

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

Member Data Documentation

◆ KEY_TYPES_COUNT

constexpr uint8_t MockedDescriptorConverter::KEY_TYPES_COUNT {6}
staticconstexprprivate

Types are raw (un)compressed pubkeys, raw xonly pubkeys, raw privkeys (WIF), xpubs, xprvs.

Definition at line 24 of file descriptor.h.

◆ keys_str

std::array<std::string, TOTAL_KEYS_GENERATED> MockedDescriptorConverter::keys_str
private

256 keys of various types.

Definition at line 28 of file descriptor.h.

◆ TOTAL_KEYS_GENERATED

constexpr size_t MockedDescriptorConverter::TOTAL_KEYS_GENERATED {std::numeric_limits<uint8_t>::max() + 1}
staticconstexprprivate

How many keys we'll generate in total.

Definition at line 26 of file descriptor.h.


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