mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
p2p: remove some old protocol version checks/dead code (#3647)
Signed-off-by: pasta <pasta@dashboost.org>
This commit is contained in:
parent
d12137b9c2
commit
7725e6fa4b
@ -510,7 +510,7 @@ void CQuorumBlockProcessor::AddMinableCommitment(const CFinalCommitment& fqc)
|
||||
// We only relay the new commitment if it's new or better then the old one
|
||||
if (relay) {
|
||||
CInv inv(MSG_QUORUM_FINAL_COMMITMENT, commitmentHash);
|
||||
g_connman->RelayInv(inv, DMN_PROTO_VERSION);
|
||||
g_connman->RelayInv(inv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1413,7 +1413,7 @@ void CConnman::InactivityCheck(CNode *pnode)
|
||||
LogPrintf("socket sending timeout: %is\n", nTime - pnode->nLastSend);
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
else if (nTime - pnode->nLastRecv > (pnode->nVersion > BIP0031_VERSION ? TIMEOUT_INTERVAL : 90*60))
|
||||
else if (nTime - pnode->nLastRecv > TIMEOUT_INTERVAL)
|
||||
{
|
||||
LogPrintf("socket receive timeout: %is\n", nTime - pnode->nLastRecv);
|
||||
pnode->fDisconnect = true;
|
||||
|
@ -2057,14 +2057,9 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
(strCommand == NetMsgType::FILTERLOAD ||
|
||||
strCommand == NetMsgType::FILTERADD))
|
||||
{
|
||||
if (pfrom->nVersion >= NO_BLOOM_VERSION) {
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->GetId(), 100);
|
||||
return false;
|
||||
} else {
|
||||
pfrom->fDisconnect = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (strCommand == NetMsgType::REJECT)
|
||||
@ -2322,15 +2317,13 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
CMNAuth::PushMNAUTH(pfrom, *connman);
|
||||
}
|
||||
|
||||
if (pfrom->nVersion >= SENDHEADERS_VERSION) {
|
||||
// Tell our peer we prefer to receive headers rather than inv's
|
||||
// We send this to non-NODE NETWORK peers as well, because even
|
||||
// non-NODE NETWORK peers can announce blocks (such as pruning
|
||||
// nodes)
|
||||
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::SENDHEADERS));
|
||||
}
|
||||
|
||||
if (pfrom->nVersion >= SHORT_IDS_BLOCKS_VERSION && !pfrom->fMasternode) {
|
||||
if (!pfrom->fMasternode) {
|
||||
// Tell our peer we are willing to provide version-1 cmpctblocks
|
||||
// However, we do not request new block announcements using
|
||||
// cmpctblock messages.
|
||||
@ -3348,8 +3341,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
}
|
||||
|
||||
if (strCommand == NetMsgType::PING) {
|
||||
if (pfrom->nVersion > BIP0031_VERSION)
|
||||
{
|
||||
uint64_t nonce = 0;
|
||||
vRecv >> nonce;
|
||||
// Echo the message back with the nonce. This allows for two useful features:
|
||||
@ -3364,7 +3355,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
// seconds to respond to each, the 5th ping the remote sends would appear to
|
||||
// return very quickly.
|
||||
connman->PushMessage(pfrom, msgMaker.Make(NetMsgType::PONG, nonce));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3908,14 +3898,8 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
|
||||
}
|
||||
pto->fPingQueued = false;
|
||||
pto->nPingUsecStart = GetTimeMicros();
|
||||
if (pto->nVersion > BIP0031_VERSION) {
|
||||
pto->nPingNonceSent = nonce;
|
||||
connman->PushMessage(pto, msgMaker.Make(NetMsgType::PING, nonce));
|
||||
} else {
|
||||
// Peer is too old to support ping command with nonce, pong will never arrive.
|
||||
pto->nPingNonceSent = 0;
|
||||
connman->PushMessage(pto, msgMaker.Make(NetMsgType::PING));
|
||||
}
|
||||
}
|
||||
|
||||
TRY_LOCK(cs_main, lockMain); // Acquire cs_main for IsInitialBlockDownload() and CNodeState()
|
||||
|
@ -16,9 +16,6 @@ static const int PROTOCOL_VERSION = 70218;
|
||||
//! initial proto version, to be increased after version/verack negotiation
|
||||
static const int INIT_PROTO_VERSION = 209;
|
||||
|
||||
//! In this version, 'getheaders' was introduced.
|
||||
static const int GETHEADERS_VERSION = 70077;
|
||||
|
||||
//! disconnect from peers older than this proto version
|
||||
static const int MIN_PEER_PROTO_VERSION = 70213;
|
||||
|
||||
@ -29,24 +26,6 @@ static const int MIN_MASTERNODE_PROTO_VERSION = 70218;
|
||||
//! if possible, avoid requesting addresses nodes older than this
|
||||
static const int CADDR_TIME_VERSION = 31402;
|
||||
|
||||
//! BIP 0031, pong message, is enabled for all versions AFTER this one
|
||||
static const int BIP0031_VERSION = 60000;
|
||||
|
||||
//! "filter*" commands are disabled without NODE_BLOOM after and including this version
|
||||
static const int NO_BLOOM_VERSION = 70201;
|
||||
|
||||
//! "sendheaders" command and announcing blocks with headers starts with this version
|
||||
static const int SENDHEADERS_VERSION = 70201;
|
||||
|
||||
//! DIP0001 was activated in this version
|
||||
static const int DIP0001_PROTOCOL_VERSION = 70208;
|
||||
|
||||
//! short-id-based block download starts with this version
|
||||
static const int SHORT_IDS_BLOCKS_VERSION = 70209;
|
||||
|
||||
//! introduction of DIP3/deterministic masternodes
|
||||
static const int DMN_PROTO_VERSION = 70213;
|
||||
|
||||
//! introduction of LLMQs
|
||||
static const int LLMQS_PROTO_VERSION = 70214;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user