mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#20646: refer to BIPs 339/155 in feature negotiation
This commit is contained in:
parent
1d4f10a378
commit
e109c0042a
@ -487,6 +487,7 @@ public:
|
||||
* messages, implying a preference to receive ADDRv2 instead of ADDR ones.
|
||||
*/
|
||||
std::atomic_bool m_wants_addrv2{false};
|
||||
/** fSuccessfullyConnected is set to true on receiving VERACK from the peer. */
|
||||
std::atomic_bool fSuccessfullyConnected{false};
|
||||
// Setting fDisconnect to true will cause the node to be disconnected the
|
||||
// next time DisconnectNodes() runs
|
||||
|
@ -3256,14 +3256,15 @@ void PeerManagerImpl::ProcessMessage(
|
||||
return;
|
||||
}
|
||||
|
||||
// BIP155 defines feature negotiation of addrv2 and sendaddrv2, which must happen
|
||||
// between VERSION and VERACK.
|
||||
if (msg_type == NetMsgType::SENDADDRV2) {
|
||||
if (pfrom.GetCommonVersion() < ADDRV2_PROTO_VERSION) {
|
||||
// Ignore previous implementations
|
||||
return;
|
||||
}
|
||||
if (pfrom.fSuccessfullyConnected) {
|
||||
// Disconnect peers that send SENDADDRV2 message after VERACK; this
|
||||
// must be negotiated between VERSION and VERACK.
|
||||
// Disconnect peers that send a SENDADDRV2 message after VERACK.
|
||||
LogPrint(BCLog::NET_NETCONN, "sendaddrv2 received after verack from peer=%d; disconnecting\n", pfrom.GetId());
|
||||
pfrom.fDisconnect = true;
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user