mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Merge bitcoin/bitcoin#28892: refactor: P2P transport without serialize version and type
fa79a881cerefactor: P2P transport without serialize version and type (MarcoFalke)fa9b5f4fe3refactor: NetMsg::Make() without nVersion (MarcoFalke)66669da4a5Remove unused Make() overload in netmessagemaker.h (MarcoFalke)fa0ed07941refactor: VectorWriter without nVersion (MarcoFalke) Pull request description: Now that the serialize framework ignores the serialize version and serialize type, everything related to it can be removed from the code. This is the first step, removing dead code from the P2P stack. A different pull will remove it from the wallet and other parts. ACKs for top commit: ajtowns: reACKfa79a881ceTree-SHA512: 785b413580d980f51f0d4f70ea5e0a99ce14cd12cb065393de2f5254891be94a14f4266110c8b87bd2dbc37467676655bce13bdb295ab139749fcd8b61bd5110
This commit is contained in:
@@ -51,9 +51,9 @@ FUZZ_TARGET(golomb_rice)
|
||||
for (int i = 0; i < n; ++i) {
|
||||
elements.insert(ConsumeRandomLengthByteVector(fuzzed_data_provider, 16));
|
||||
}
|
||||
CVectorWriter stream{0, golomb_rice_data, 0};
|
||||
VectorWriter stream{golomb_rice_data, 0};
|
||||
WriteCompactSize(stream, static_cast<uint32_t>(elements.size()));
|
||||
BitStreamWriter<CVectorWriter> bitwriter(stream);
|
||||
BitStreamWriter bitwriter{stream};
|
||||
if (!elements.empty()) {
|
||||
uint64_t last_value = 0;
|
||||
for (const uint64_t value : BuildHashedSet(elements, static_cast<uint64_t>(elements.size()) * static_cast<uint64_t>(BASIC_FILTER_M))) {
|
||||
|
||||
@@ -36,8 +36,8 @@ void initialize_p2p_transport_serialization()
|
||||
FUZZ_TARGET(p2p_transport_serialization, .init = initialize_p2p_transport_serialization)
|
||||
{
|
||||
// Construct transports for both sides, with dummy NodeIds.
|
||||
V1Transport recv_transport{NodeId{0}, SER_NETWORK, INIT_PROTO_VERSION};
|
||||
V1Transport send_transport{NodeId{1}, SER_NETWORK, INIT_PROTO_VERSION};
|
||||
V1Transport recv_transport{NodeId{0}};
|
||||
V1Transport send_transport{NodeId{1}};
|
||||
|
||||
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
|
||||
|
||||
@@ -88,7 +88,7 @@ FUZZ_TARGET(p2p_transport_serialization, .init = initialize_p2p_transport_serial
|
||||
assert(msg.m_time == m_time);
|
||||
|
||||
std::vector<unsigned char> header;
|
||||
auto msg2 = CNetMsgMaker{msg.m_recv.GetVersion()}.Make(msg.m_type, Span{msg.m_recv});
|
||||
auto msg2 = NetMsg::Make(msg.m_type, Span{msg.m_recv});
|
||||
bool queued = send_transport.SetMessageToSend(msg2);
|
||||
assert(queued);
|
||||
std::optional<bool> known_more;
|
||||
@@ -335,7 +335,7 @@ void SimulationTest(Transport& initiator, Transport& responder, R& rng, FuzzedDa
|
||||
|
||||
std::unique_ptr<Transport> MakeV1Transport(NodeId nodeid) noexcept
|
||||
{
|
||||
return std::make_unique<V1Transport>(nodeid, SER_NETWORK, INIT_PROTO_VERSION);
|
||||
return std::make_unique<V1Transport>(nodeid);
|
||||
}
|
||||
|
||||
template<typename RNG>
|
||||
@@ -369,7 +369,7 @@ std::unique_ptr<Transport> MakeV2Transport(NodeId nodeid, bool initiator, RNG& r
|
||||
.Write(garb.data(), garb.size())
|
||||
.Finalize(UCharCast(ent.data()));
|
||||
|
||||
return std::make_unique<V2Transport>(nodeid, initiator, SER_NETWORK, INIT_PROTO_VERSION, key, ent, std::move(garb));
|
||||
return std::make_unique<V2Transport>(nodeid, initiator, key, ent, std::move(garb));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user