mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
fuzz: Drop unused params from serialize helpers
With the ser-type and ser-version going away, it seems unlikely that there is need for them in the future, so just remove them.
This commit is contained in:
parent
adc0921ea1
commit
fa5b6d29ee
1 changed files with 7 additions and 9 deletions
|
@ -91,9 +91,9 @@ void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj, const P& params
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
CDataStream Serialize(const T& obj, const int version = INIT_PROTO_VERSION, const int ser_type = SER_NETWORK)
|
CDataStream Serialize(const T& obj)
|
||||||
{
|
{
|
||||||
CDataStream ds(ser_type, version);
|
CDataStream ds{SER_NETWORK, INIT_PROTO_VERSION};
|
||||||
ds << obj;
|
ds << obj;
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
@ -107,12 +107,10 @@ T Deserialize(CDataStream ds)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj, const std::optional<int> protocol_version = std::nullopt, const int ser_type = SER_NETWORK)
|
void DeserializeFromFuzzingInput(FuzzBufferType buffer, T&& obj)
|
||||||
{
|
{
|
||||||
CDataStream ds(buffer, ser_type, INIT_PROTO_VERSION);
|
CDataStream ds{buffer, SER_NETWORK, INIT_PROTO_VERSION};
|
||||||
if (protocol_version) {
|
{
|
||||||
ds.SetVersion(*protocol_version);
|
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
int version;
|
int version;
|
||||||
ds >> version;
|
ds >> version;
|
||||||
|
@ -135,9 +133,9 @@ void AssertEqualAfterSerializeDeserialize(const T& obj, const P& params)
|
||||||
assert(Deserialize<T>(Serialize(obj, params), params) == obj);
|
assert(Deserialize<T>(Serialize(obj, params), params) == obj);
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AssertEqualAfterSerializeDeserialize(const T& obj, const int version = INIT_PROTO_VERSION, const int ser_type = SER_NETWORK)
|
void AssertEqualAfterSerializeDeserialize(const T& obj)
|
||||||
{
|
{
|
||||||
assert(Deserialize<T>(Serialize(obj, version, ser_type)) == obj);
|
assert(Deserialize<T>(Serialize(obj)) == obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Add table
Reference in a new issue