Skip to content

Commit

Permalink
Bump net protocol version + don't send 'sendaddrv2' to pre-70923 soft…
Browse files Browse the repository at this point in the history
…ware
  • Loading branch information
furszy committed Aug 10, 2021
1 parent ccd508a commit 61c2ed4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,18 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
if (pfrom->fInbound)
PushNodeVersion(pfrom, connman, GetAdjustedTime());

CNetMsgMaker msg_maker(INIT_PROTO_VERSION);
connman->PushMessage(pfrom, msg_maker.Make(NetMsgType::VERACK));

if (nVersion >= 70923) {
// BIP155 defines addrv2 and sendaddrv2 for all protocol versions, but some
// implementations reject messages they don't know. As a courtesy, don't send
// it to nodes with a version before 70923 (v5.2.99), as no software is known to support
// BIP155 that doesn't announce at least that protocol version number.

connman->PushMessage(pfrom, msg_maker.Make(NetMsgType::SENDADDRV2));
}

pfrom->nServices = nServices;
pfrom->SetAddrLocal(addrMe);
{
Expand All @@ -1170,12 +1182,6 @@ bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vR
pfrom->SetSendVersion(nSendVersion);
pfrom->nVersion = nVersion;

CNetMsgMaker msg_maker(INIT_PROTO_VERSION);
connman->PushMessage(pfrom, msg_maker.Make(NetMsgType::VERACK));

// Signal ADDRv2 support (BIP155).
connman->PushMessage(pfrom, msg_maker.Make(NetMsgType::SENDADDRV2));

{
LOCK(cs_main);
// Potentially mark this peer as a preferred download peer.
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* network protocol versioning
*/

static const int PROTOCOL_VERSION = 70922;
static const int PROTOCOL_VERSION = 70923;

//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_framework/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from .util import hex_str_to_bytes, bytes_to_hex_str

MIN_VERSION_SUPPORTED = 60001
MY_VERSION = 70922
MY_VERSION = 70923
MY_SUBVERSION = "/python-mininode-tester:0.0.3/"
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)

Expand Down

0 comments on commit 61c2ed4

Please sign in to comment.