Skip to content

Serialization-deserialization roundtrip of CPubKey does not necessarily result in an equal object #17238

@practicalswift

Description

@practicalswift

When fuzzing the serialization code for CPubKey I noticed that Deserialize<CPubKey>(Serialize(obj)) == obj does not hold true for all CPubKey obj.

Is there any reason to why CPubKey is deviating from the other serializable classes (for which equality is defined) in this regard? :)

Context:

template <typename T>
CDataStream Serialize(const T& obj)
{
    CDataStream ds(SER_NETWORK, INIT_PROTO_VERSION);
    ds << obj;
    return ds;
}

template <typename T>
T Deserialize(CDataStream ds)
{
    T obj;
    ds >> obj;
    return obj;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions