aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-10-31 10:51:37 +0000
committerfanquake <fanquake@gmail.com>2023-10-31 11:11:25 +0000
commitd51fb9caa622add96c6b594e162da5584eb927fc (patch)
tree3b123d191897ddd1740296698e8df373337656a5 /src/net_processing.cpp
parent4458ae811a264968c2a7ea4bb7050eed492a7e36 (diff)
parent99990194ce26af89308fab5ad0b1c8c26e45f80c (diff)
downloadbitcoin-d51fb9caa622add96c6b594e162da5584eb927fc.tar.xz
Merge bitcoin/bitcoin#28503: refactor: Remove WithParams serialization helper, use SER_PARAMS_OPFUNC
99990194ce26af89308fab5ad0b1c8c26e45f80c Remove WithParams serialization helper (MarcoFalke) ffffb4af83a47979a0ecc84247bc1167abc2fbf6 scripted-diff: Use ser params operator (MarcoFalke) fae9054793ff2a15db1a645cce3df749e0de2f39 test: Use SER_PARAMS_OPFUNC in serialize_tests.cpp (MarcoFalke) Pull request description: Every serialization parameter struct already has the `SER_PARAMS_OPFUNC`, except for one in the tests. For consistency, and to remove verbose code, convert the test to `SER_PARAMS_OPFUNC`, and use it everywhere, then remove the `WithParams` helper. ACKs for top commit: ajtowns: reACK 99990194ce26af89308fab5ad0b1c8c26e45f80c TheCharlatan: Re-ACK 99990194ce26af89308fab5ad0b1c8c26e45f80c Tree-SHA512: be9cae4225a502486fe8d552aaf4b2cd2904a9f73cce9d931c6b7c757594ff1982fcc2c30d00d012cd12b0a9531fd609f8bcd7c94b811e965ac087eb8a3589d3
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 7fcc399151..2f41eb2b1d 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -3770,7 +3770,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
std::vector<CAddress> vAddr;
- vRecv >> WithParams(ser_params, vAddr);
+ vRecv >> ser_params(vAddr);
if (!SetupAddressRelay(pfrom, *peer)) {
LogPrint(BCLog::NET, "ignoring %s message from %s peer=%d\n", msg_type, pfrom.ConnectionTypeAsString(), pfrom.GetId());
@@ -5375,16 +5375,12 @@ void PeerManagerImpl::MaybeSendAddr(CNode& node, Peer& peer, std::chrono::micros
// No addr messages to send
if (peer.m_addrs_to_send.empty()) return;
- const char* msg_type;
- CNetAddr::Encoding ser_enc;
+ CNetMsgMaker mm(node.GetCommonVersion());
if (peer.m_wants_addrv2) {
- msg_type = NetMsgType::ADDRV2;
- ser_enc = CNetAddr::Encoding::V2;
+ m_connman.PushMessage(&node, mm.Make(NetMsgType::ADDRV2, CAddress::V2_NETWORK(peer.m_addrs_to_send)));
} else {
- msg_type = NetMsgType::ADDR;
- ser_enc = CNetAddr::Encoding::V1;
+ m_connman.PushMessage(&node, mm.Make(NetMsgType::ADDR, CAddress::V1_NETWORK(peer.m_addrs_to_send)));
}
- m_connman.PushMessage(&node, CNetMsgMaker(node.GetCommonVersion()).Make(msg_type, WithParams(CAddress::SerParams{{ser_enc}, CAddress::Format::Network}, peer.m_addrs_to_send)));
peer.m_addrs_to_send.clear();
// we only send the big addr message once