refactor: NetMsg::Make() without nVersion

The nVersion field is unused, so remove it.

This is also required for future commits.

Also, add PushMessage aliases in PeerManagerImpl to make calling code
less verbose.

Co-Authored-By: Anthony Towns <aj@erisian.com.au>
This commit is contained in:
MarcoFalke
2023-11-16 15:43:15 +01:00
parent 66669da4a5
commit fa9b5f4fe3
5 changed files with 74 additions and 97 deletions

View File

@@ -9,19 +9,15 @@
#include <net.h>
#include <serialize.h>
class CNetMsgMaker
{
public:
explicit CNetMsgMaker(int /*unused*/) {}
namespace NetMsg {
template <typename... Args>
CSerializedNetMsg Make(std::string msg_type, Args&&... args) const
CSerializedNetMsg Make(std::string msg_type, Args&&... args)
{
CSerializedNetMsg msg;
msg.m_type = std::move(msg_type);
VectorWriter{msg.data, 0, std::forward<Args>(args)...};
return msg;
}
};
} // namespace NetMsg
#endif // BITCOIN_NETMESSAGEMAKER_H