Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.h
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
// Serialize HD keypaths to a stream from a map | // Serialize HD keypaths to a stream from a map | ||||
template <typename Stream> | template <typename Stream> | ||||
void SerializeHDKeypaths(Stream &s, | void SerializeHDKeypaths(Stream &s, | ||||
const std::map<CPubKey, KeyOriginInfo> &hd_keypaths, | const std::map<CPubKey, KeyOriginInfo> &hd_keypaths, | ||||
uint8_t type) { | uint8_t type) { | ||||
for (auto keypath_pair : hd_keypaths) { | for (auto keypath_pair : hd_keypaths) { | ||||
if (!keypath_pair.first.IsValid()) { | |||||
throw std::ios_base::failure("Invalid CPubKey being serialized"); | |||||
} | |||||
SerializeToVector(s, type, MakeSpan(keypath_pair.first)); | SerializeToVector(s, type, MakeSpan(keypath_pair.first)); | ||||
WriteCompactSize(s, (keypath_pair.second.path.size() + 1) * | WriteCompactSize(s, (keypath_pair.second.path.size() + 1) * | ||||
sizeof(uint32_t)); | sizeof(uint32_t)); | ||||
s << keypath_pair.second.fingerprint; | s << keypath_pair.second.fingerprint; | ||||
for (const auto &path : keypath_pair.second.path) { | for (const auto &path : keypath_pair.second.path) { | ||||
s << path; | s << path; | ||||
} | } | ||||
} | } | ||||
Show All 29 Lines |