mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#19486: Remove unused constants CADDR_TIME_VERSION and GETHEADERS_VERSION
This commit is contained in:
parent
cca796aeb3
commit
b513441300
@ -408,7 +408,13 @@ public:
|
|||||||
READWRITE(nVersion);
|
READWRITE(nVersion);
|
||||||
}
|
}
|
||||||
if ((s.GetType() & SER_DISK) ||
|
if ((s.GetType() & SER_DISK) ||
|
||||||
(nVersion >= CADDR_TIME_VERSION && !(s.GetType() & SER_GETHASH))) {
|
(nVersion != INIT_PROTO_VERSION && !(s.GetType() & SER_GETHASH))) {
|
||||||
|
// The only time we serialize a CAddress object without nTime is in
|
||||||
|
// the initial VERSION messages which contain two CAddress records.
|
||||||
|
// At that point, the serialization version is INIT_PROTO_VERSION.
|
||||||
|
// After the version handshake, serialization version is >=
|
||||||
|
// MIN_PEER_PROTO_VERSION and all ADDR messages are serialized with
|
||||||
|
// nTime.
|
||||||
READWRITE(obj.nTime);
|
READWRITE(obj.nTime);
|
||||||
}
|
}
|
||||||
if (nVersion & ADDRV2_FORMAT) {
|
if (nVersion & ADDRV2_FORMAT) {
|
||||||
|
@ -22,10 +22,6 @@ static const int MIN_PEER_PROTO_VERSION = 70215;
|
|||||||
//! minimum proto version of masternode to accept in DKGs
|
//! minimum proto version of masternode to accept in DKGs
|
||||||
static const int MIN_MASTERNODE_PROTO_VERSION = 70221;
|
static const int MIN_MASTERNODE_PROTO_VERSION = 70221;
|
||||||
|
|
||||||
//! nTime field added to CAddress, starting with this version;
|
|
||||||
//! if possible, avoid requesting addresses nodes older than this
|
|
||||||
static const int CADDR_TIME_VERSION = 31402;
|
|
||||||
|
|
||||||
//! protocol version is included in MNAUTH starting with this version
|
//! protocol version is included in MNAUTH starting with this version
|
||||||
static const int MNAUTH_NODE_VER_VERSION = 70218;
|
static const int MNAUTH_NODE_VER_VERSION = 70218;
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ class CAddress:
|
|||||||
self.ip = "0.0.0.0"
|
self.ip = "0.0.0.0"
|
||||||
self.port = 0
|
self.port = 0
|
||||||
|
|
||||||
def deserialize(self, f, with_time=True):
|
def deserialize(self, f, *, with_time=True):
|
||||||
"""Deserialize from addrv1 format (pre-BIP155)"""
|
"""Deserialize from addrv1 format (pre-BIP155)"""
|
||||||
if with_time:
|
if with_time:
|
||||||
# VERSION messages serialize CAddress objects without time
|
# VERSION messages serialize CAddress objects without time
|
||||||
@ -267,7 +267,7 @@ class CAddress:
|
|||||||
self.ip = socket.inet_ntoa(f.read(4))
|
self.ip = socket.inet_ntoa(f.read(4))
|
||||||
self.port = struct.unpack(">H", f.read(2))[0]
|
self.port = struct.unpack(">H", f.read(2))[0]
|
||||||
|
|
||||||
def serialize(self, with_time=True):
|
def serialize(self, *, with_time=True):
|
||||||
"""Serialize in addrv1 format (pre-BIP155)"""
|
"""Serialize in addrv1 format (pre-BIP155)"""
|
||||||
assert self.net == self.NET_IPV4
|
assert self.net == self.NET_IPV4
|
||||||
r = b""
|
r = b""
|
||||||
@ -1371,10 +1371,10 @@ class msg_version:
|
|||||||
self.nServices = struct.unpack("<Q", f.read(8))[0]
|
self.nServices = struct.unpack("<Q", f.read(8))[0]
|
||||||
self.nTime = struct.unpack("<q", f.read(8))[0]
|
self.nTime = struct.unpack("<q", f.read(8))[0]
|
||||||
self.addrTo = CAddress()
|
self.addrTo = CAddress()
|
||||||
self.addrTo.deserialize(f, False)
|
self.addrTo.deserialize(f, with_time=False)
|
||||||
|
|
||||||
self.addrFrom = CAddress()
|
self.addrFrom = CAddress()
|
||||||
self.addrFrom.deserialize(f, False)
|
self.addrFrom.deserialize(f, with_time=False)
|
||||||
self.nNonce = struct.unpack("<Q", f.read(8))[0]
|
self.nNonce = struct.unpack("<Q", f.read(8))[0]
|
||||||
self.strSubVer = deser_string(f)
|
self.strSubVer = deser_string(f)
|
||||||
|
|
||||||
@ -1394,8 +1394,8 @@ class msg_version:
|
|||||||
r += struct.pack("<i", self.nVersion)
|
r += struct.pack("<i", self.nVersion)
|
||||||
r += struct.pack("<Q", self.nServices)
|
r += struct.pack("<Q", self.nServices)
|
||||||
r += struct.pack("<q", self.nTime)
|
r += struct.pack("<q", self.nTime)
|
||||||
r += self.addrTo.serialize(False)
|
r += self.addrTo.serialize(with_time=False)
|
||||||
r += self.addrFrom.serialize(False)
|
r += self.addrFrom.serialize(with_time=False)
|
||||||
r += struct.pack("<Q", self.nNonce)
|
r += struct.pack("<Q", self.nNonce)
|
||||||
r += ser_string(self.strSubVer)
|
r += ser_string(self.strSubVer)
|
||||||
r += struct.pack("<i", self.nStartingHeight)
|
r += struct.pack("<i", self.nStartingHeight)
|
||||||
|
Loading…
Reference in New Issue
Block a user