HomePhabricator

Add CSerializedNetMsg::Copy() helper

Description

Add CSerializedNetMsg::Copy() helper

Summary:
This makes code that uses the helper less verbose.

Moreover, this makes net_processing C++20 compliant. Otherwise, it would
lead to a compile error (see below). C++20 disables aggregate
initialization when any constructor is declared. See
http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1008r1.pdf

net_processing.cpp:1627:42: error: no matching constructor for initialization of 'CSerializedNetMsg'
            m_connman.PushMessage(pnode, CSerializedNetMsg{ser_cmpctblock.data, ser_cmpctblock.m_type});
                                         ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a partial backport of core#24169
https://github.com/bitcoin/bitcoin/pull/24169/commits/fae679065e4ef0c6383bbdd1876aaed6c1e40104

Depends on D15316

Note that after this diff it is possible to set set(CMAKE_CXX_STANDARD 20)

Test Plan:
ninja all check-all

And rerun the compilation and tests with set(CMAKE_CXX_STANDARD 20) in src/CMakeLists.txt

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15317

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Mar 24 2022, 10:44
PiRKCommitted on Jan 30 2024, 15:42
teamcityPushed on Jan 30 2024, 15:45
Parents
rSTAGINGd0d00810dac2: Make fs.h C++20 compliant and improve fs::PathToString documentation
Branches
Unknown
Tags
Unknown

Event Timeline