mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Drop support for pre-12.1 nodes (#1394)
This commit is contained in:
parent
d63080100a
commit
9ed9474a9e
@ -35,7 +35,7 @@ import copy
|
|||||||
import dash_hash
|
import dash_hash
|
||||||
|
|
||||||
BIP0031_VERSION = 60000
|
BIP0031_VERSION = 60000
|
||||||
MY_VERSION = 70103 # past bip-31 for ping/pong
|
MY_VERSION = 70206 # current MIN_PEER_PROTO_VERSION
|
||||||
MY_SUBVERSION = b"/python-mininode-tester:0.0.2/"
|
MY_SUBVERSION = b"/python-mininode-tester:0.0.2/"
|
||||||
|
|
||||||
MAX_INV_SZ = 50000
|
MAX_INV_SZ = 50000
|
||||||
|
@ -313,7 +313,6 @@ void CDarksendPool::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataS
|
|||||||
|
|
||||||
if(nMsgMessageID < MSG_POOL_MIN || nMsgMessageID > MSG_POOL_MAX) {
|
if(nMsgMessageID < MSG_POOL_MIN || nMsgMessageID > MSG_POOL_MAX) {
|
||||||
LogPrint("privatesend", "DSSTATUSUPDATE -- nMsgMessageID is out of bounds: %d\n", nMsgMessageID);
|
LogPrint("privatesend", "DSSTATUSUPDATE -- nMsgMessageID is out of bounds: %d\n", nMsgMessageID);
|
||||||
if(pfrom->nVersion < 70203) nMsgMessageID = MSG_NOERR;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class CGovernanceObject;
|
|||||||
class CGovernanceVote;
|
class CGovernanceVote;
|
||||||
|
|
||||||
static const int MAX_GOVERNANCE_OBJECT_DATA_SIZE = 16 * 1024;
|
static const int MAX_GOVERNANCE_OBJECT_DATA_SIZE = 16 * 1024;
|
||||||
static const int MIN_GOVERNANCE_PEER_PROTO_VERSION = 70204;
|
static const int MIN_GOVERNANCE_PEER_PROTO_VERSION = 70206;
|
||||||
static const int GOVERNANCE_FILTER_PROTO_VERSION = 70206;
|
static const int GOVERNANCE_FILTER_PROTO_VERSION = 70206;
|
||||||
|
|
||||||
static const double GOVERNANCE_FILTER_FP_RATE = 0.001;
|
static const double GOVERNANCE_FILTER_FP_RATE = 0.001;
|
||||||
|
@ -27,7 +27,7 @@ extern CInstantSend instantsend;
|
|||||||
static const int INSTANTSEND_CONFIRMATIONS_REQUIRED = 6;
|
static const int INSTANTSEND_CONFIRMATIONS_REQUIRED = 6;
|
||||||
static const int DEFAULT_INSTANTSEND_DEPTH = 5;
|
static const int DEFAULT_INSTANTSEND_DEPTH = 5;
|
||||||
|
|
||||||
static const int MIN_INSTANTSEND_PROTO_VERSION = 70205;
|
static const int MIN_INSTANTSEND_PROTO_VERSION = 70206;
|
||||||
|
|
||||||
extern bool fEnableInstantSend;
|
extern bool fEnableInstantSend;
|
||||||
extern int nInstantSendDepth;
|
extern int nInstantSendDepth;
|
||||||
|
@ -5173,10 +5173,6 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
|
|||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
ss.reserve(1000);
|
ss.reserve(1000);
|
||||||
ss << mnodeman.mapSeenMasternodeBroadcast[inv.hash].second;
|
ss << mnodeman.mapSeenMasternodeBroadcast[inv.hash].second;
|
||||||
// backward compatibility patch
|
|
||||||
if(pfrom->nVersion < 70204) {
|
|
||||||
ss << (int64_t)0;
|
|
||||||
}
|
|
||||||
pfrom->PushMessage(NetMsgType::MNANNOUNCE, ss);
|
pfrom->PushMessage(NetMsgType::MNANNOUNCE, ss);
|
||||||
pushed = true;
|
pushed = true;
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, std::string& strCommand,
|
|||||||
}
|
}
|
||||||
netfulfilledman.AddFulfilledRequest(pfrom->addr, NetMsgType::MASTERNODEPAYMENTSYNC);
|
netfulfilledman.AddFulfilledRequest(pfrom->addr, NetMsgType::MASTERNODEPAYMENTSYNC);
|
||||||
|
|
||||||
Sync(pfrom, nCountNeeded);
|
Sync(pfrom);
|
||||||
LogPrintf("MASTERNODEPAYMENTSYNC -- Sent Masternode payment votes to peer %d\n", pfrom->id);
|
LogPrintf("MASTERNODEPAYMENTSYNC -- Sent Masternode payment votes to peer %d\n", pfrom->id);
|
||||||
|
|
||||||
} else if (strCommand == NetMsgType::MASTERNODEPAYMENTVOTE) { // Masternode Payments Vote for the Winner
|
} else if (strCommand == NetMsgType::MASTERNODEPAYMENTVOTE) { // Masternode Payments Vote for the Winner
|
||||||
@ -812,25 +812,16 @@ std::string CMasternodePaymentVote::ToString() const
|
|||||||
return info.str();
|
return info.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send all votes up to nCountNeeded blocks (but not more than GetStorageLimit)
|
// Send only votes for future blocks, node should request every other missing payment block individually
|
||||||
void CMasternodePayments::Sync(CNode* pnode, int nCountNeeded)
|
void CMasternodePayments::Sync(CNode* pnode)
|
||||||
{
|
{
|
||||||
LOCK(cs_mapMasternodeBlocks);
|
LOCK(cs_mapMasternodeBlocks);
|
||||||
|
|
||||||
if(!pCurrentBlockIndex) return;
|
if(!pCurrentBlockIndex) return;
|
||||||
|
|
||||||
if(pnode->nVersion < 70202) {
|
|
||||||
// Old nodes can only sync via heavy method
|
|
||||||
int nLimit = GetStorageLimit();
|
|
||||||
if(nCountNeeded > nLimit) nCountNeeded = nLimit;
|
|
||||||
} else {
|
|
||||||
// New nodes request missing payment blocks themselves, push only votes for future blocks to them
|
|
||||||
nCountNeeded = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nInvCount = 0;
|
int nInvCount = 0;
|
||||||
|
|
||||||
for(int h = pCurrentBlockIndex->nHeight - nCountNeeded; h < pCurrentBlockIndex->nHeight + 20; h++) {
|
for(int h = pCurrentBlockIndex->nHeight; h < pCurrentBlockIndex->nHeight + 20; h++) {
|
||||||
if(mapMasternodeBlocks.count(h)) {
|
if(mapMasternodeBlocks.count(h)) {
|
||||||
BOOST_FOREACH(CMasternodePayee& payee, mapMasternodeBlocks[h].vecPayees) {
|
BOOST_FOREACH(CMasternodePayee& payee, mapMasternodeBlocks[h].vecPayees) {
|
||||||
std::vector<uint256> vecVoteHashes = payee.GetVoteHashes();
|
std::vector<uint256> vecVoteHashes = payee.GetVoteHashes();
|
||||||
@ -850,8 +841,6 @@ void CMasternodePayments::Sync(CNode* pnode, int nCountNeeded)
|
|||||||
// Request low data/unknown payment blocks in batches directly from some node instead of/after preliminary Sync.
|
// Request low data/unknown payment blocks in batches directly from some node instead of/after preliminary Sync.
|
||||||
void CMasternodePayments::RequestLowDataPaymentBlocks(CNode* pnode)
|
void CMasternodePayments::RequestLowDataPaymentBlocks(CNode* pnode)
|
||||||
{
|
{
|
||||||
// Old nodes can't process this
|
|
||||||
if(pnode->nVersion < 70202) return;
|
|
||||||
if(!pCurrentBlockIndex) return;
|
if(!pCurrentBlockIndex) return;
|
||||||
|
|
||||||
LOCK2(cs_main, cs_mapMasternodeBlocks);
|
LOCK2(cs_main, cs_mapMasternodeBlocks);
|
||||||
|
@ -23,8 +23,8 @@ static const int MNPAYMENTS_SIGNATURES_TOTAL = 10;
|
|||||||
// vote for masternode and be elected as a payment winner
|
// vote for masternode and be elected as a payment winner
|
||||||
// V1 - Last protocol version before update
|
// V1 - Last protocol version before update
|
||||||
// V2 - Newest protocol version
|
// V2 - Newest protocol version
|
||||||
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70103;
|
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70206;
|
||||||
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70204;
|
static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70206;
|
||||||
|
|
||||||
extern CCriticalSection cs_vecPayees;
|
extern CCriticalSection cs_vecPayees;
|
||||||
extern CCriticalSection cs_mapMasternodeBlocks;
|
extern CCriticalSection cs_mapMasternodeBlocks;
|
||||||
@ -196,7 +196,7 @@ public:
|
|||||||
bool HasVerifiedPaymentVote(uint256 hashIn);
|
bool HasVerifiedPaymentVote(uint256 hashIn);
|
||||||
bool ProcessBlock(int nBlockHeight);
|
bool ProcessBlock(int nBlockHeight);
|
||||||
|
|
||||||
void Sync(CNode* node, int nCountNeeded);
|
void Sync(CNode* node);
|
||||||
void RequestLowDataPaymentBlocks(CNode* pnode);
|
void RequestLowDataPaymentBlocks(CNode* pnode);
|
||||||
void CheckAndRemove();
|
void CheckAndRemove();
|
||||||
|
|
||||||
|
@ -226,22 +226,6 @@ void CMasternode::Check(bool fForce)
|
|||||||
// keep old masternodes on start, give them a chance to receive updates...
|
// keep old masternodes on start, give them a chance to receive updates...
|
||||||
bool fWaitForPing = !masternodeSync.IsMasternodeListSynced() && !IsPingedWithin(MASTERNODE_MIN_MNP_SECONDS);
|
bool fWaitForPing = !masternodeSync.IsMasternodeListSynced() && !IsPingedWithin(MASTERNODE_MIN_MNP_SECONDS);
|
||||||
|
|
||||||
//
|
|
||||||
// REMOVE AFTER MIGRATION TO 12.1
|
|
||||||
//
|
|
||||||
// Old nodes don't send pings on dseg, so they could switch to one of the expired states
|
|
||||||
// if we were offline for too long even if they are actually enabled for the rest
|
|
||||||
// of the network. Postpone their check for MASTERNODE_MIN_MNP_SECONDS seconds.
|
|
||||||
// This could be usefull for 12.1 migration, can be removed after it's done.
|
|
||||||
static int64_t nTimeStart = GetTime();
|
|
||||||
if(nProtocolVersion < 70204) {
|
|
||||||
if(!masternodeSync.IsMasternodeListSynced()) nTimeStart = GetTime();
|
|
||||||
fWaitForPing = GetTime() - nTimeStart < MASTERNODE_MIN_MNP_SECONDS;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// END REMOVE
|
|
||||||
//
|
|
||||||
|
|
||||||
if(fWaitForPing && !fOurMasternode) {
|
if(fWaitForPing && !fOurMasternode) {
|
||||||
// ...but if it was already expired before the initial check - return right away
|
// ...but if it was already expired before the initial check - return right away
|
||||||
if(IsExpired() || IsWatchdogExpired() || IsNewStartRequired()) {
|
if(IsExpired() || IsWatchdogExpired() || IsNewStartRequired()) {
|
||||||
@ -715,48 +699,6 @@ bool CMasternodeBroadcast::CheckSignature(int& nDos)
|
|||||||
std::string strError = "";
|
std::string strError = "";
|
||||||
nDos = 0;
|
nDos = 0;
|
||||||
|
|
||||||
//
|
|
||||||
// REMOVE AFTER MIGRATION TO 12.1
|
|
||||||
//
|
|
||||||
if(nProtocolVersion < 70201) {
|
|
||||||
std::string vchPubkeyCollateralAddress(pubKeyCollateralAddress.begin(), pubKeyCollateralAddress.end());
|
|
||||||
std::string vchPubkeyMasternode(pubKeyMasternode.begin(), pubKeyMasternode.end());
|
|
||||||
strMessage = addr.ToString(false) + boost::lexical_cast<std::string>(sigTime) +
|
|
||||||
vchPubkeyCollateralAddress + vchPubkeyMasternode + boost::lexical_cast<std::string>(nProtocolVersion);
|
|
||||||
|
|
||||||
LogPrint("masternode", "CMasternodeBroadcast::CheckSignature -- sanitized strMessage: %s pubKeyCollateralAddress address: %s sig: %s\n",
|
|
||||||
SanitizeString(strMessage), CBitcoinAddress(pubKeyCollateralAddress.GetID()).ToString(),
|
|
||||||
EncodeBase64(&vchSig[0], vchSig.size()));
|
|
||||||
|
|
||||||
if(!darkSendSigner.VerifyMessage(pubKeyCollateralAddress, vchSig, strMessage, strError)) {
|
|
||||||
if(addr.ToString() != addr.ToString(false)) {
|
|
||||||
// maybe it's wrong format, try again with the old one
|
|
||||||
strMessage = addr.ToString() + boost::lexical_cast<std::string>(sigTime) +
|
|
||||||
vchPubkeyCollateralAddress + vchPubkeyMasternode + boost::lexical_cast<std::string>(nProtocolVersion);
|
|
||||||
|
|
||||||
LogPrint("masternode", "CMasternodeBroadcast::CheckSignature -- second try, sanitized strMessage: %s pubKeyCollateralAddress address: %s sig: %s\n",
|
|
||||||
SanitizeString(strMessage), CBitcoinAddress(pubKeyCollateralAddress.GetID()).ToString(),
|
|
||||||
EncodeBase64(&vchSig[0], vchSig.size()));
|
|
||||||
|
|
||||||
if(!darkSendSigner.VerifyMessage(pubKeyCollateralAddress, vchSig, strMessage, strError)) {
|
|
||||||
// didn't work either
|
|
||||||
LogPrintf("CMasternodeBroadcast::CheckSignature -- Got bad Masternode announce signature, second try, sanitized error: %s\n",
|
|
||||||
SanitizeString(strError));
|
|
||||||
// don't ban for old masternodes, their sigs could be broken because of the bug
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// nope, sig is actually wrong
|
|
||||||
LogPrintf("CMasternodeBroadcast::CheckSignature -- Got bad Masternode announce signature, sanitized error: %s\n",
|
|
||||||
SanitizeString(strError));
|
|
||||||
// don't ban for old masternodes, their sigs could be broken because of the bug
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// END REMOVE
|
|
||||||
//
|
|
||||||
strMessage = addr.ToString(false) + boost::lexical_cast<std::string>(sigTime) +
|
strMessage = addr.ToString(false) + boost::lexical_cast<std::string>(sigTime) +
|
||||||
pubKeyCollateralAddress.GetID().ToString() + pubKeyMasternode.GetID().ToString() +
|
pubKeyCollateralAddress.GetID().ToString() + pubKeyMasternode.GetID().ToString() +
|
||||||
boost::lexical_cast<std::string>(nProtocolVersion);
|
boost::lexical_cast<std::string>(nProtocolVersion);
|
||||||
@ -768,7 +710,6 @@ bool CMasternodeBroadcast::CheckSignature(int& nDos)
|
|||||||
nDos = 100;
|
nDos = 100;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -366,20 +366,9 @@ public:
|
|||||||
uint256 GetHash() const
|
uint256 GetHash() const
|
||||||
{
|
{
|
||||||
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
|
||||||
//
|
|
||||||
// REMOVE AFTER MIGRATION TO 12.1
|
|
||||||
//
|
|
||||||
if(nProtocolVersion < 70201) {
|
|
||||||
ss << sigTime;
|
|
||||||
ss << pubKeyCollateralAddress;
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// END REMOVE
|
|
||||||
//
|
|
||||||
ss << vin;
|
ss << vin;
|
||||||
ss << pubKeyCollateralAddress;
|
ss << pubKeyCollateralAddress;
|
||||||
ss << sigTime;
|
ss << sigTime;
|
||||||
}
|
|
||||||
return ss.GetHash();
|
return ss.GetHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,12 +814,6 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
|||||||
|
|
||||||
LogPrint("masternode", "MNANNOUNCE -- Masternode announce, masternode=%s\n", mnb.vin.prevout.ToStringShort());
|
LogPrint("masternode", "MNANNOUNCE -- Masternode announce, masternode=%s\n", mnb.vin.prevout.ToStringShort());
|
||||||
|
|
||||||
// backward compatibility patch
|
|
||||||
if(pfrom->nVersion < 70204) {
|
|
||||||
int64_t nLastDsqDummy;
|
|
||||||
vRecv >> nLastDsqDummy;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nDos = 0;
|
int nDos = 0;
|
||||||
|
|
||||||
if (CheckMnbAndUpdateMasternodeList(pfrom, mnb, nDos)) {
|
if (CheckMnbAndUpdateMasternodeList(pfrom, mnb, nDos)) {
|
||||||
|
@ -19,7 +19,7 @@ static const int INIT_PROTO_VERSION = 209;
|
|||||||
static const int GETHEADERS_VERSION = 70077;
|
static const int GETHEADERS_VERSION = 70077;
|
||||||
|
|
||||||
//! disconnect from peers older than this proto version
|
//! disconnect from peers older than this proto version
|
||||||
static const int MIN_PEER_PROTO_VERSION = 70103;
|
static const int MIN_PEER_PROTO_VERSION = 70206;
|
||||||
|
|
||||||
//! nTime field added to CAddress, starting with this version;
|
//! nTime field added to CAddress, starting with this version;
|
||||||
//! if possible, avoid requesting addresses nodes older than this
|
//! if possible, avoid requesting addresses nodes older than this
|
||||||
|
Loading…
Reference in New Issue
Block a user