mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
fuzz, refactor: Remove Serialize overload
Serialization parameters should be embedded into the object being
serialized rather than passed as a separate argument. This works here
because only serialization is performed and no new object needs to be
constructed.
Github-Pull: #35679
Rebased-From: afab8d4225
This commit is contained in:
committed by
fanquake
parent
504ded6b0e
commit
444f2d7965
@@ -57,14 +57,6 @@ namespace {
|
||||
struct invalid_fuzzing_input_exception : public std::exception {
|
||||
};
|
||||
|
||||
template <typename T, typename P>
|
||||
DataStream Serialize(const T& obj, const P& params)
|
||||
{
|
||||
DataStream ds{};
|
||||
ds << params(obj);
|
||||
return ds;
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
T Deserialize(DataStream&& ds, const P& params)
|
||||
{
|
||||
@@ -103,7 +95,7 @@ void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj)
|
||||
template <typename T, typename P>
|
||||
void AssertEqualAfterSerializeDeserialize(const T& obj, const P& params)
|
||||
{
|
||||
assert(Deserialize<T>(Serialize(obj, params), params) == obj);
|
||||
assert(Deserialize<T>(Serialize(params(obj)), params) == obj);
|
||||
}
|
||||
template <typename T>
|
||||
void AssertEqualAfterSerializeDeserialize(const T& obj)
|
||||
|
||||
Reference in New Issue
Block a user