MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / ParseKeyPath

Function ParseKeyPath

src/script/descriptor.cpp:434–448  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

432
433/** Parse a key path, being passed a split list of elements (the first element is ignored). */
434bool ParseKeyPath(const std::vector<Span<const char>>& split, KeyPath& out)
435{
436 for (size_t i = 1; i < split.size(); ++i) {
437 Span<const char> elem = split[i];
438 bool hardened = false;
439 if (elem.size() > 0 && (elem[elem.size() - 1] == '\'' || elem[elem.size() - 1] == 'h')) {
440 elem = elem.first(elem.size() - 1);
441 hardened = true;
442 }
443 uint32_t p;
444 if (!ParseUInt32(std::string(elem.begin(), elem.end()), &p) || p > 0x7FFFFFFFUL) return false;
445 out.push_back(p | (((uint32_t)hardened) << 31));
446 }
447 return true;
448}
449
450std::unique_ptr<PubkeyProvider> ParsePubkey(const Span<const char>& sp, bool permit_uncompressed, FlatSigningProvider& out)
451{

Callers 1

ParsePubkeyFunction · 0.85

Calls 6

ParseUInt32Function · 0.85
firstMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected