mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +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
945aa9866e
commit
21e2137011
@@ -55,14 +55,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)
|
||||
{
|
||||
@@ -102,7 +94,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