@@ -2362,8 +2362,6 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
2362
2362
m_connman.PushMessage (&pfrom, msg_maker.Make (NetMsgType::WTXIDRELAY));
2363
2363
}
2364
2364
2365
- m_connman.PushMessage (&pfrom, msg_maker.Make (NetMsgType::VERACK));
2366
-
2367
2365
// Signal ADDRv2 support (BIP155).
2368
2366
if (greatest_common_version >= 70016 ) {
2369
2367
// BIP155 defines addrv2 and sendaddrv2 for all protocol versions, but some
@@ -2373,6 +2371,8 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
2373
2371
m_connman.PushMessage (&pfrom, msg_maker.Make (NetMsgType::SENDADDRV2));
2374
2372
}
2375
2373
2374
+ m_connman.PushMessage (&pfrom, msg_maker.Make (NetMsgType::VERACK));
2375
+
2376
2376
pfrom.nServices = nServices;
2377
2377
pfrom.SetAddrLocal (addrMe);
2378
2378
{
@@ -2541,6 +2541,17 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
2541
2541
return ;
2542
2542
}
2543
2543
2544
+ if (msg_type == NetMsgType::SENDADDRV2) {
2545
+ if (pfrom.fSuccessfullyConnected ) {
2546
+ // Disconnect peers that send SENDADDRV2 message after VERACK; this
2547
+ // must be negotiated between VERSION and VERACK.
2548
+ pfrom.fDisconnect = true ;
2549
+ return ;
2550
+ }
2551
+ pfrom.m_wants_addrv2 = true ;
2552
+ return ;
2553
+ }
2554
+
2544
2555
if (!pfrom.fSuccessfullyConnected ) {
2545
2556
LogPrint (BCLog::NET, " Unsupported message \" %s\" prior to verack from peer=%d\n " , SanitizeString (msg_type), pfrom.GetId ());
2546
2557
return ;
@@ -2608,11 +2619,6 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
2608
2619
return ;
2609
2620
}
2610
2621
2611
- if (msg_type == NetMsgType::SENDADDRV2) {
2612
- pfrom.m_wants_addrv2 = true ;
2613
- return ;
2614
- }
2615
-
2616
2622
if (msg_type == NetMsgType::SENDHEADERS) {
2617
2623
LOCK (cs_main);
2618
2624
State (pfrom.GetId ())->fPreferHeaders = true ;
0 commit comments