MCPcopy Create free account
hub / github.com/ElementsProject/elements / DeserializeHDKeypath

Function DeserializeHDKeypath

src/psbt.h:165–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163// Deserialize an individual HD keypath to a stream
164template<typename Stream>
165void DeserializeHDKeypath(Stream& s, KeyOriginInfo& hd_keypath)
166{
167 // Read in key path
168 uint64_t value_len = ReadCompactSize(s);
169 if (value_len % 4 || value_len == 0) {
170 throw std::ios_base::failure("Invalid length for HD key path");
171 }
172
173 s >> hd_keypath.fingerprint;
174 for (unsigned int i = 4; i < value_len; i += sizeof(uint32_t)) {
175 uint32_t index;
176 s >> index;
177 hd_keypath.path.push_back(index);
178 }
179}
180
181// Deserialize HD keypaths into a map
182template<typename Stream>

Callers 2

DeserializeHDKeypathsFunction · 0.85
UnserializeMethod · 0.85

Calls 2

ReadCompactSizeFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected