MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ParseHexStr

Function ParseHexStr

src/script/miniscript.h:1825–1835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1823/** Parse a hex string fully contained within a fragment with the name given by 'func' */
1824template<typename Ctx>
1825std::optional<std::vector<unsigned char>> ParseHexStr(const std::string& func, std::span<const char>& in, const size_t expected_size,
1826 const Ctx& ctx)
1827{
1828 std::span<const char> expr = script::Expr(in);
1829 if (!script::Func(func, expr)) return {};
1830 std::string val = std::string(expr.begin(), expr.end());
1831 if (!IsHex(val)) return {};
1832 auto hash = ParseHex(val);
1833 if (hash.size() != expected_size) return {};
1834 return hash;
1835}
1836
1837/** BuildBack pops the last two elements off `constructed` and wraps them in the specified Fragment */
1838template<typename Key>

Callers 1

ParseFunction · 0.85

Calls 7

ExprFunction · 0.85
FuncFunction · 0.85
IsHexFunction · 0.85
ParseHexFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected