5#ifndef BITCOIN_TEST_FUZZ_UTIL_DESCRIPTOR_H
6#define BITCOIN_TEST_FUZZ_UTIL_DESCRIPTOR_H
28 std::array<std::string, TOTAL_KEYS_GENERATED>
keys_str;
43 std::optional<uint8_t>
IdxFromHex(std::string_view hex_characters)
const;
46 std::optional<std::string>
GetDescriptor(std::string_view mocked_desc)
const;
Converts a mocked descriptor string to a valid one.
static constexpr uint8_t KEY_TYPES_COUNT
Types are raw (un)compressed pubkeys, raw xonly pubkeys, raw privkeys (WIF), xpubs,...
bool IdIsUnCompPubKey(uint8_t idx) const
bool IdIsXOnlyPubKey(uint8_t idx) const
void Init()
When initializing the target, populate the list of keys.
static constexpr size_t TOTAL_KEYS_GENERATED
How many keys we'll generate in total.
bool IdIsXpub(uint8_t idx) const
std::optional< std::string > GetDescriptor(std::string_view mocked_desc) const
Get an actual descriptor string from a descriptor string whose keys were mocked.
bool IdIsXprv(uint8_t idx) const
bool IdIsCompPubKey(uint8_t idx) const
std::array< std::string, TOTAL_KEYS_GENERATED > keys_str
256 keys of various types.
bool IdIsConstPrivKey(uint8_t idx) const
std::optional< uint8_t > IdxFromHex(std::string_view hex_characters) const
Parse an id in the keys vectors from a 2-characters hex string.
std::span< const uint8_t > FuzzBufferType
constexpr int MAX_SUBS
Default maximum number of sub-fragments.
bool HasTooManySubFrag(const FuzzBufferType &buff, const int max_subs=MAX_SUBS, const size_t max_nested_subs=MAX_NESTED_SUBS)
Whether the buffer, if it represents a valid descriptor, contains a fragment with more sub-fragments ...
constexpr int MAX_WRAPPERS
Default maximum number of wrappers per fragment.
constexpr size_t MAX_NESTED_SUBS
Maximum number of nested sub-fragments we'll allow in a descriptor.
constexpr int MAX_DEPTH
Default maximum number of derivation indexes in a single derivation path when limiting its depth.
bool HasTooManyWrappers(const FuzzBufferType &buff, const int max_wrappers=MAX_WRAPPERS)
Whether the buffer, if it represents a valid descriptor, contains a fragment with more wrappers than ...
bool HasDeepDerivPath(const FuzzBufferType &buff, const int max_depth=MAX_DEPTH)
Whether the buffer, if it represents a valid descriptor, contains a derivation path deeper than a giv...