diff --git a/src/libSchnorr/src/Schnorr_PubKey.cpp b/src/libSchnorr/src/Schnorr_PubKey.cpp index 01c3b52..9a85911 100644 --- a/src/libSchnorr/src/Schnorr_PubKey.cpp +++ b/src/libSchnorr/src/Schnorr_PubKey.cpp @@ -19,6 +19,11 @@ #include #include +#include +#include +#include +#include + #include "Schnorr.h" #include "SchnorrInternal.h" @@ -112,8 +117,14 @@ bool PubKey::Serialize(bytes& dst, unsigned int offset) const { } bool PubKey::Deserialize(const bytes& src, unsigned int offset) { + + if (src.size() != PUB_KEY_SIZE && src.size() != (PUB_KEY_SIZE * 2)) { + std::cout << "Deserialized pubkey size is incorrect with size: " << src.size() << std::endl; + std::abort(); + } + shared_ptr result = - ECPOINTSerialize::GetNumber(src, offset, PUB_KEY_SIZE); + ECPOINTSerialize::GetNumber(src, offset, src.size()); if (result == nullptr) { // ECPOINTSerialize::GetNumber failed