Skip to content

Commit 7737603

Browse files
committed
Merge #17785: p2p: Unify Send and Receive protocol versions
ddefb5c p2p: Use the greatest common version in peer logic (Hennadii Stepanov) e084d45 p2p: Remove SetCommonVersion() from VERACK handler (Hennadii Stepanov) 8d20267 refactor: Rename local variable nSendVersion (Hennadii Stepanov) e9a6d8b p2p: Unify Send and Receive protocol versions (Hennadii Stepanov) Pull request description: On master (6fef85b) `CNode` has two members to keep protocol version: - `nRecvVersion` for received messages - `nSendVersion` for messages to send After exchanging with `VERSION` and `VERACK` messages via protocol version `INIT_PROTO_VERSION`, both nodes set `nRecvVersion` _and_ `nSendVersion` to _the same_ value which is the greatest common protocol version. This PR: - replaces two `CNode` members, `nRecvVersion` `nSendVersion`, with `m_greatest_common_version` - removes duplicated getter and setter There is no change in behavior on the P2P network. ACKs for top commit: jnewbery: ACK ddefb5c naumenkogs: ACK ddefb5c fjahr: Code review ACK ddefb5c amitiuttarwar: code review but untested ACK ddefb5c benthecarman: utACK `ddefb5c` Tree-SHA512: 5305538dbaa5426b923b0afd20bdef4f248d310855d1d78427210c00716c67b7cb691515c421716b6157913e453076e293b10ff5fd2cd26a8e5375d42da7809d
2 parents 8c5f681 + ddefb5c commit 7737603

File tree

7 files changed

+54
-92
lines changed

7 files changed

+54
-92
lines changed

src/net.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -622,32 +622,6 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete
622622
return true;
623623
}
624624

625-
void CNode::SetSendVersion(int nVersionIn)
626-
{
627-
// Send version may only be changed in the version message, and
628-
// only one version message is allowed per session. We can therefore
629-
// treat this value as const and even atomic as long as it's only used
630-
// once a version message has been successfully processed. Any attempt to
631-
// set this twice is an error.
632-
if (nSendVersion != 0) {
633-
error("Send version already set for node: %i. Refusing to change from %i to %i", id, nSendVersion, nVersionIn);
634-
} else {
635-
nSendVersion = nVersionIn;
636-
}
637-
}
638-
639-
int CNode::GetSendVersion() const
640-
{
641-
// The send version should always be explicitly set to
642-
// INIT_PROTO_VERSION rather than using this value until SetSendVersion
643-
// has been called.
644-
if (nSendVersion == 0) {
645-
error("Requesting unset send version for node: %i. Using %i", id, INIT_PROTO_VERSION);
646-
return INIT_PROTO_VERSION;
647-
}
648-
return nSendVersion;
649-
}
650-
651625
int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
652626
{
653627
// copy data to temporary parsing buffer
@@ -1194,7 +1168,7 @@ void CConnman::InactivityCheck(CNode *pnode)
11941168
LogPrintf("socket sending timeout: %is\n", nTime - pnode->nLastSend);
11951169
pnode->fDisconnect = true;
11961170
}
1197-
else if (nTime - pnode->nLastRecv > (pnode->nVersion > BIP0031_VERSION ? TIMEOUT_INTERVAL : 90*60))
1171+
else if (nTime - pnode->nLastRecv > (pnode->GetCommonVersion() > BIP0031_VERSION ? TIMEOUT_INTERVAL : 90*60))
11981172
{
11991173
LogPrintf("socket receive timeout: %is\n", nTime - pnode->nLastRecv);
12001174
pnode->fDisconnect = true;

src/net.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ class CNode
831831

832832
std::deque<CInv> vRecvGetData;
833833
uint64_t nRecvBytes GUARDED_BY(cs_vRecv){0};
834-
std::atomic<int> nRecvVersion{INIT_PROTO_VERSION};
835834

836835
std::atomic<int64_t> nLastSend{0};
837836
std::atomic<int64_t> nLastRecv{0};
@@ -1018,6 +1017,7 @@ class CNode
10181017
const NodeId id;
10191018
const uint64_t nLocalHostNonce;
10201019
const ConnectionType m_conn_type;
1020+
std::atomic<int> m_greatest_common_version{INIT_PROTO_VERSION};
10211021

10221022
//! Services offered to this peer.
10231023
//!
@@ -1037,7 +1037,6 @@ class CNode
10371037
const ServiceFlags nLocalServices;
10381038

10391039
const int nMyStartingHeight;
1040-
int nSendVersion{0};
10411040
NetPermissionFlags m_permissionFlags{ PF_NONE };
10421041
std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
10431042

@@ -1069,16 +1068,14 @@ class CNode
10691068

10701069
bool ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete);
10711070

1072-
void SetRecvVersion(int nVersionIn)
1071+
void SetCommonVersion(int greatest_common_version)
10731072
{
1074-
nRecvVersion = nVersionIn;
1073+
m_greatest_common_version = greatest_common_version;
10751074
}
1076-
int GetRecvVersion() const
1075+
int GetCommonVersion() const
10771076
{
1078-
return nRecvVersion;
1077+
return m_greatest_common_version;
10791078
}
1080-
void SetSendVersion(int nVersionIn);
1081-
int GetSendVersion() const;
10821079

10831080
CService GetAddrLocal() const;
10841081
//! May not be called more than once

src/net_processing.cpp

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,12 @@ static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman& connma
669669
// As per BIP152, we only get 3 of our peers to announce
670670
// blocks using compact encodings.
671671
connman.ForNode(lNodesAnnouncingHeaderAndIDs.front(), [&connman, nCMPCTBLOCKVersion](CNode* pnodeStop){
672-
connman.PushMessage(pnodeStop, CNetMsgMaker(pnodeStop->GetSendVersion()).Make(NetMsgType::SENDCMPCT, /*fAnnounceUsingCMPCTBLOCK=*/false, nCMPCTBLOCKVersion));
672+
connman.PushMessage(pnodeStop, CNetMsgMaker(pnodeStop->GetCommonVersion()).Make(NetMsgType::SENDCMPCT, /*fAnnounceUsingCMPCTBLOCK=*/false, nCMPCTBLOCKVersion));
673673
return true;
674674
});
675675
lNodesAnnouncingHeaderAndIDs.pop_front();
676676
}
677-
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::SENDCMPCT, /*fAnnounceUsingCMPCTBLOCK=*/true, nCMPCTBLOCKVersion));
677+
connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetCommonVersion()).Make(NetMsgType::SENDCMPCT, /*fAnnounceUsingCMPCTBLOCK=*/true, nCMPCTBLOCKVersion));
678678
lNodesAnnouncingHeaderAndIDs.push_back(pfrom->GetId());
679679
return true;
680680
});
@@ -1359,7 +1359,7 @@ void PeerManager::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_
13591359
LockAssertion lock(::cs_main);
13601360

13611361
// TODO: Avoid the repeated-serialization here
1362-
if (pnode->nVersion < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect)
1362+
if (pnode->GetCommonVersion() < INVALID_CB_NO_BAN_VERSION || pnode->fDisconnect)
13631363
return;
13641364
ProcessBlockAvailability(pnode->GetId());
13651365
CNodeState &state = *State(pnode->GetId());
@@ -1586,7 +1586,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
15861586
LogPrint(BCLog::NET, "%s: ignoring request from peer=%i for old block that isn't in the main chain\n", __func__, pfrom.GetId());
15871587
}
15881588
}
1589-
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
1589+
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
15901590
// disconnect node in case we have reached the outbound limit for serving historical blocks
15911591
if (send &&
15921592
connman.OutboundTargetReached(true) &&
@@ -1729,7 +1729,7 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm
17291729

17301730
std::deque<CInv>::iterator it = pfrom.vRecvGetData.begin();
17311731
std::vector<CInv> vNotFound;
1732-
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
1732+
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
17331733

17341734
const std::chrono::seconds now = GetTime<std::chrono::seconds>();
17351735
// Get last mempool request time
@@ -1835,14 +1835,14 @@ void PeerManager::SendBlockTransactions(CNode& pfrom, const CBlock& block, const
18351835
resp.txn[i] = block.vtx[req.indexes[i]];
18361836
}
18371837
LOCK(cs_main);
1838-
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
1838+
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
18391839
int nSendFlags = State(pfrom.GetId())->fWantsCmpctWitness ? 0 : SERIALIZE_TRANSACTION_NO_WITNESS;
18401840
m_connman.PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::BLOCKTXN, resp));
18411841
}
18421842

18431843
void PeerManager::ProcessHeadersMessage(CNode& pfrom, const std::vector<CBlockHeader>& headers, bool via_compact_block)
18441844
{
1845-
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
1845+
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
18461846
size_t nCount = headers.size();
18471847

18481848
if (nCount == 0) {
@@ -2212,7 +2212,7 @@ static void ProcessGetCFilters(CNode& peer, CDataStream& vRecv, const CChainPara
22122212
}
22132213

22142214
for (const auto& filter : filters) {
2215-
CSerializedNetMsg msg = CNetMsgMaker(peer.GetSendVersion())
2215+
CSerializedNetMsg msg = CNetMsgMaker(peer.GetCommonVersion())
22162216
.Make(NetMsgType::CFILTER, filter);
22172217
connman.PushMessage(&peer, std::move(msg));
22182218
}
@@ -2264,7 +2264,7 @@ static void ProcessGetCFHeaders(CNode& peer, CDataStream& vRecv, const CChainPar
22642264
return;
22652265
}
22662266

2267-
CSerializedNetMsg msg = CNetMsgMaker(peer.GetSendVersion())
2267+
CSerializedNetMsg msg = CNetMsgMaker(peer.GetCommonVersion())
22682268
.Make(NetMsgType::CFHEADERS,
22692269
filter_type_ser,
22702270
stop_index->GetBlockHash(),
@@ -2316,7 +2316,7 @@ static void ProcessGetCFCheckPt(CNode& peer, CDataStream& vRecv, const CChainPar
23162316
}
23172317
}
23182318

2319-
CSerializedNetMsg msg = CNetMsgMaker(peer.GetSendVersion())
2319+
CSerializedNetMsg msg = CNetMsgMaker(peer.GetCommonVersion())
23202320
.Make(NetMsgType::CFCHECKPT,
23212321
filter_type_ser,
23222322
stop_index->GetBlockHash(),
@@ -2351,13 +2351,11 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
23512351
uint64_t nServiceInt;
23522352
ServiceFlags nServices;
23532353
int nVersion;
2354-
int nSendVersion;
23552354
std::string cleanSubVer;
23562355
int nStartingHeight = -1;
23572356
bool fRelay = true;
23582357

23592358
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
2360-
nSendVersion = std::min(nVersion, PROTOCOL_VERSION);
23612359
nServices = ServiceFlags(nServiceInt);
23622360
if (!pfrom.IsInboundConn())
23632361
{
@@ -2406,11 +2404,16 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24062404
if (pfrom.IsInboundConn())
24072405
PushNodeVersion(pfrom, m_connman, GetAdjustedTime());
24082406

2409-
if (nVersion >= WTXID_RELAY_VERSION) {
2410-
m_connman.PushMessage(&pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::WTXIDRELAY));
2407+
// Change version
2408+
const int greatest_common_version = std::min(nVersion, PROTOCOL_VERSION);
2409+
pfrom.SetCommonVersion(greatest_common_version);
2410+
pfrom.nVersion = nVersion;
2411+
2412+
if (greatest_common_version >= WTXID_RELAY_VERSION) {
2413+
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::WTXIDRELAY));
24112414
}
24122415

2413-
m_connman.PushMessage(&pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::VERACK));
2416+
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::VERACK));
24142417

24152418
pfrom.nServices = nServices;
24162419
pfrom.SetAddrLocal(addrMe);
@@ -2431,10 +2434,6 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24312434
pfrom.m_tx_relay->fRelayTxes = fRelay; // set to true after we get the first filter* message
24322435
}
24332436

2434-
// Change version
2435-
pfrom.SetSendVersion(nSendVersion);
2436-
pfrom.nVersion = nVersion;
2437-
24382437
if((nServices & NODE_WITNESS))
24392438
{
24402439
LOCK(cs_main);
@@ -2480,7 +2479,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24802479
}
24812480

24822481
// Get recent addresses
2483-
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
2482+
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::GETADDR));
24842483
pfrom.fGetAddr = true;
24852484

24862485
// Moves address from New to Tried table in Addrman, resolves
@@ -2502,9 +2501,9 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
25022501
AddTimeData(pfrom.addr, nTimeOffset);
25032502

25042503
// If the peer is old enough to have the old alert system, send it the final alert.
2505-
if (pfrom.nVersion <= 70012) {
2504+
if (greatest_common_version <= 70012) {
25062505
CDataStream finalAlert(ParseHex("60010000000000000000000000ffffff7f00000000ffffff7ffeffff7f01ffffff7f00000000ffffff7f00ffffff7f002f555247454e543a20416c657274206b657920636f6d70726f6d697365642c2075706772616465207265717569726564004630440220653febd6410f470f6bae11cad19c48413becb1ac2c17f908fd0fd53bdc3abd5202206d0e9c96fe88d4a0f01ed9dedae2b6f9e00da94cad0fecaae66ecf689bf71b50"), SER_NETWORK, PROTOCOL_VERSION);
2507-
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make("alert", finalAlert));
2506+
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make("alert", finalAlert));
25082507
}
25092508

25102509
// Feeler connections exist only to verify if address is online.
@@ -2521,12 +2520,10 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
25212520
}
25222521

25232522
// At this point, the outgoing message serialization version can't change.
2524-
const CNetMsgMaker msgMaker(pfrom.GetSendVersion());
2523+
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
25252524

25262525
if (msg_type == NetMsgType::VERACK)
25272526
{
2528-
pfrom.SetRecvVersion(std::min(pfrom.nVersion.load(), PROTOCOL_VERSION));
2529-
25302527
if (!pfrom.IsInboundConn()) {
25312528
// Mark this node as currently connected, so we update its timestamp later.
25322529
LOCK(cs_main);
@@ -2537,14 +2534,14 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
25372534
pfrom.m_tx_relay == nullptr ? "block-relay" : "full-relay");
25382535
}
25392536

2540-
if (pfrom.nVersion >= SENDHEADERS_VERSION) {
2537+
if (pfrom.GetCommonVersion() >= SENDHEADERS_VERSION) {
25412538
// Tell our peer we prefer to receive headers rather than inv's
25422539
// We send this to non-NODE NETWORK peers as well, because even
25432540
// non-NODE NETWORK peers can announce blocks (such as pruning
25442541
// nodes)
25452542
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::SENDHEADERS));
25462543
}
2547-
if (pfrom.nVersion >= SHORT_IDS_BLOCKS_VERSION) {
2544+
if (pfrom.GetCommonVersion() >= SHORT_IDS_BLOCKS_VERSION) {
25482545
// Tell our peer we are willing to provide version 1 or 2 cmpctblocks
25492546
// However, we do not request new block announcements using
25502547
// cmpctblock messages.
@@ -2570,7 +2567,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
25702567
pfrom.fDisconnect = true;
25712568
return;
25722569
}
2573-
if (pfrom.nVersion >= WTXID_RELAY_VERSION) {
2570+
if (pfrom.GetCommonVersion() >= WTXID_RELAY_VERSION) {
25742571
LOCK(cs_main);
25752572
if (!State(pfrom.GetId())->m_wtxid_relay) {
25762573
State(pfrom.GetId())->m_wtxid_relay = true;
@@ -3583,8 +3580,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
35833580
}
35843581

35853582
if (msg_type == NetMsgType::PING) {
3586-
if (pfrom.nVersion > BIP0031_VERSION)
3587-
{
3583+
if (pfrom.GetCommonVersion() > BIP0031_VERSION) {
35883584
uint64_t nonce = 0;
35893585
vRecv >> nonce;
35903586
// Echo the message back with the nonce. This allows for two useful features:
@@ -3871,7 +3867,7 @@ bool PeerManager::ProcessMessages(CNode* pfrom, std::atomic<bool>& interruptMsgP
38713867
}
38723868
CNetMessage& msg(msgs.front());
38733869

3874-
msg.SetVersion(pfrom->GetRecvVersion());
3870+
msg.SetVersion(pfrom->GetCommonVersion());
38753871
// Check network magic
38763872
if (!msg.m_valid_netmagic) {
38773873
LogPrint(BCLog::NET, "PROCESSMESSAGE: INVALID MESSAGESTART %s peer=%d\n", SanitizeString(msg.m_command), pfrom->GetId());
@@ -3919,7 +3915,7 @@ void PeerManager::ConsiderEviction(CNode& pto, int64_t time_in_seconds)
39193915
AssertLockHeld(cs_main);
39203916

39213917
CNodeState &state = *State(pto.GetId());
3922-
const CNetMsgMaker msgMaker(pto.GetSendVersion());
3918+
const CNetMsgMaker msgMaker(pto.GetCommonVersion());
39233919

39243920
if (!state.m_chain_sync.m_protect && pto.IsOutboundOrBlockRelayConn() && state.fSyncStarted) {
39253921
// This is an outbound peer subject to disconnection if they don't
@@ -4081,7 +4077,7 @@ bool PeerManager::SendMessages(CNode* pto)
40814077
return true;
40824078

40834079
// If we get here, the outgoing message serialization version is set and can't change.
4084-
const CNetMsgMaker msgMaker(pto->GetSendVersion());
4080+
const CNetMsgMaker msgMaker(pto->GetCommonVersion());
40854081

40864082
//
40874083
// Message: ping
@@ -4102,7 +4098,7 @@ bool PeerManager::SendMessages(CNode* pto)
41024098
}
41034099
pto->fPingQueued = false;
41044100
pto->m_ping_start = GetTime<std::chrono::microseconds>();
4105-
if (pto->nVersion > BIP0031_VERSION) {
4101+
if (pto->GetCommonVersion() > BIP0031_VERSION) {
41064102
pto->nPingNonceSent = nonce;
41074103
m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::PING, nonce));
41084104
} else {
@@ -4641,7 +4637,7 @@ bool PeerManager::SendMessages(CNode* pto)
46414637
//
46424638
// Message: feefilter
46434639
//
4644-
if (pto->m_tx_relay != nullptr && pto->nVersion >= FEEFILTER_VERSION && gArgs.GetBoolArg("-feefilter", DEFAULT_FEEFILTER) &&
4640+
if (pto->m_tx_relay != nullptr && pto->GetCommonVersion() >= FEEFILTER_VERSION && gArgs.GetBoolArg("-feefilter", DEFAULT_FEEFILTER) &&
46454641
!pto->HasPermission(PF_FORCERELAY) // peers with the forcerelay permission should not filter txs to us
46464642
) {
46474643
CAmount currentFilter = m_mempool.GetMinFee(gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();

src/test/denialofservice_tests.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
8585
// Mock an outbound peer
8686
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
8787
CNode dummyNode1(id++, ServiceFlags(NODE_NETWORK | NODE_WITNESS), 0, INVALID_SOCKET, addr1, 0, 0, CAddress(), "", ConnectionType::OUTBOUND_FULL_RELAY);
88-
dummyNode1.SetSendVersion(PROTOCOL_VERSION);
88+
dummyNode1.SetCommonVersion(PROTOCOL_VERSION);
8989

9090
peerLogic->InitializeNode(&dummyNode1);
9191
dummyNode1.nVersion = 1;
@@ -138,7 +138,7 @@ static void AddRandomOutboundPeer(std::vector<CNode *> &vNodes, PeerManager &pee
138138
CAddress addr(ip(g_insecure_rand_ctx.randbits(32)), NODE_NONE);
139139
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK | NODE_WITNESS), 0, INVALID_SOCKET, addr, 0, 0, CAddress(), "", ConnectionType::OUTBOUND_FULL_RELAY));
140140
CNode &node = *vNodes.back();
141-
node.SetSendVersion(PROTOCOL_VERSION);
141+
node.SetCommonVersion(PROTOCOL_VERSION);
142142

143143
peerLogic.InitializeNode(&node);
144144
node.nVersion = 1;
@@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
229229
banman->ClearBanned();
230230
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
231231
CNode dummyNode1(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr1, 0, 0, CAddress(), "", ConnectionType::INBOUND);
232-
dummyNode1.SetSendVersion(PROTOCOL_VERSION);
232+
dummyNode1.SetCommonVersion(PROTOCOL_VERSION);
233233
peerLogic->InitializeNode(&dummyNode1);
234234
dummyNode1.nVersion = 1;
235235
dummyNode1.fSuccessfullyConnected = true;
@@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
243243

244244
CAddress addr2(ip(0xa0b0c002), NODE_NONE);
245245
CNode dummyNode2(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr2, 1, 1, CAddress(), "", ConnectionType::INBOUND);
246-
dummyNode2.SetSendVersion(PROTOCOL_VERSION);
246+
dummyNode2.SetCommonVersion(PROTOCOL_VERSION);
247247
peerLogic->InitializeNode(&dummyNode2);
248248
dummyNode2.nVersion = 1;
249249
dummyNode2.fSuccessfullyConnected = true;
@@ -280,7 +280,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
280280

281281
CAddress addr(ip(0xa0b0c001), NODE_NONE);
282282
CNode dummyNode(id++, NODE_NETWORK, 0, INVALID_SOCKET, addr, 4, 4, CAddress(), "", ConnectionType::INBOUND);
283-
dummyNode.SetSendVersion(PROTOCOL_VERSION);
283+
dummyNode.SetCommonVersion(PROTOCOL_VERSION);
284284
peerLogic->InitializeNode(&dummyNode);
285285
dummyNode.nVersion = 1;
286286
dummyNode.fSuccessfullyConnected = true;

0 commit comments

Comments
 (0)