Skip to content

Commit 5b52aa6

Browse files
author
MarcoFalke
committed
Merge #14025: p2p: Remove dead code for nVersion=10300
fa74d3d qa: Remove unused deserialization code in msg_version (MarcoFalke) fa5099c p2p: Remove dead code for nVersion=10300 (MarcoFalke) Pull request description: This code is undocumented and confusing as well as dead, since peers with a version that old are disconnected immediately. Tree-SHA512: 58c131a2730b630ffdc191cd65fe736ed1bd57e184902e2af1b1399443c4654617e68774432016df023434055e85d2e8cd32fb03b40c508c3bb8db6d19427434
2 parents 271b379 + fa74d3d commit 5b52aa6

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,8 +1662,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
16621662
return false;
16631663
}
16641664

1665-
if (nVersion < MIN_PEER_PROTO_VERSION)
1666-
{
1665+
if (nVersion < MIN_PEER_PROTO_VERSION) {
16671666
// disconnect from peers older than this proto version
16681667
LogPrint(BCLog::NET, "peer=%d using obsolete version %i; disconnecting\n", pfrom->GetId(), nVersion);
16691668
if (enable_bip61) {
@@ -1674,8 +1673,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
16741673
return false;
16751674
}
16761675

1677-
if (nVersion == 10300)
1678-
nVersion = 300;
16791676
if (!vRecv.empty())
16801677
vRecv >> addrFrom >> nNonce;
16811678
if (!vRecv.empty()) {

test/functional/test_framework/messages.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -904,28 +904,17 @@ def __init__(self):
904904

905905
def deserialize(self, f):
906906
self.nVersion = struct.unpack("<i", f.read(4))[0]
907-
if self.nVersion == 10300:
908-
self.nVersion = 300
909907
self.nServices = struct.unpack("<Q", f.read(8))[0]
910908
self.nTime = struct.unpack("<q", f.read(8))[0]
911909
self.addrTo = CAddress()
912910
self.addrTo.deserialize(f, False)
913911

914-
if self.nVersion >= 106:
915-
self.addrFrom = CAddress()
916-
self.addrFrom.deserialize(f, False)
917-
self.nNonce = struct.unpack("<Q", f.read(8))[0]
918-
self.strSubVer = deser_string(f)
919-
else:
920-
self.addrFrom = None
921-
self.nNonce = None
922-
self.strSubVer = None
923-
self.nStartingHeight = None
912+
self.addrFrom = CAddress()
913+
self.addrFrom.deserialize(f, False)
914+
self.nNonce = struct.unpack("<Q", f.read(8))[0]
915+
self.strSubVer = deser_string(f)
924916

925-
if self.nVersion >= 209:
926-
self.nStartingHeight = struct.unpack("<i", f.read(4))[0]
927-
else:
928-
self.nStartingHeight = None
917+
self.nStartingHeight = struct.unpack("<i", f.read(4))[0]
929918

930919
if self.nVersion >= 70001:
931920
# Relay field is optional for version 70001 onwards

0 commit comments

Comments
 (0)