Changeset View
Changeset View
Standalone View
Standalone View
src/script/sign.h
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | void UnserializeFromVector(Stream &s, X &... args) { | ||||
} | } | ||||
} | } | ||||
// Deserialize HD keypaths into a map | // Deserialize HD keypaths into a map | ||||
template <typename Stream> | template <typename Stream> | ||||
void DeserializeHDKeypaths(Stream &s, const std::vector<uint8_t> &key, | void DeserializeHDKeypaths(Stream &s, const std::vector<uint8_t> &key, | ||||
std::map<CPubKey, KeyOriginInfo> &hd_keypaths) { | std::map<CPubKey, KeyOriginInfo> &hd_keypaths) { | ||||
// Make sure that the key is the size of pubkey + 1 | // Make sure that the key is the size of pubkey + 1 | ||||
if (key.size() != CPubKey::PUBLIC_KEY_SIZE + 1 && | if (key.size() != CPubKey::SIZE + 1 && | ||||
key.size() != CPubKey::COMPRESSED_PUBLIC_KEY_SIZE + 1) { | key.size() != CPubKey::COMPRESSED_SIZE + 1) { | ||||
throw std::ios_base::failure( | throw std::ios_base::failure( | ||||
"Size of key was not the expected size for the type BIP32 keypath"); | "Size of key was not the expected size for the type BIP32 keypath"); | ||||
} | } | ||||
// Read in the pubkey from key | // Read in the pubkey from key | ||||
CPubKey pubkey(key.begin() + 1, key.end()); | CPubKey pubkey(key.begin() + 1, key.end()); | ||||
if (!pubkey.IsFullyValid()) { | if (!pubkey.IsFullyValid()) { | ||||
throw std::ios_base::failure("Invalid pubkey"); | throw std::ios_base::failure("Invalid pubkey"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |