From 86fc050495ab4ec5d816a4f83f40b34429bf3f52 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 12 Feb 2019 22:51:21 +0300 Subject: [PATCH] Drop no longer used code and bump min protos (#2697) * Drop registry deletion of the old key * Drop no longer used CGovernanceObjectVoteFile::RemoveOldVotes() * Drop temporary disconnect code and bump min protos to 70213 * drop comment * fix --- contrib/seeds/makeseeds.py | 2 +- qa/rpc-tests/test_framework/mininode.py | 2 +- share/setup.nsi.in | 7 ------- src/governance-object.cpp | 3 --- src/governance-object.h | 2 +- src/governance-votedb.cpp | 17 --------------- src/governance-votedb.h | 3 --- src/instantx.h | 2 +- src/net_processing.cpp | 28 ++----------------------- src/version.h | 5 +---- 10 files changed, 7 insertions(+), 64 deletions(-) diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py index c4b279618d..c4b8df45f1 100755 --- a/contrib/seeds/makeseeds.py +++ b/contrib/seeds/makeseeds.py @@ -10,7 +10,7 @@ NSEEDS=512 MAX_SEEDS_PER_ASN=4 -MIN_PROTOCOL_VERSION = 70210 +MIN_PROTOCOL_VERSION = 70213 MAX_LAST_SEEN_DIFF = 60 * 60 * 24 * 1 # 1 day MAX_LAST_PAID_DIFF = 60 * 60 * 24 * 30 # 1 month diff --git a/qa/rpc-tests/test_framework/mininode.py b/qa/rpc-tests/test_framework/mininode.py index 5551ddbe9b..182a45e16c 100755 --- a/qa/rpc-tests/test_framework/mininode.py +++ b/qa/rpc-tests/test_framework/mininode.py @@ -39,7 +39,7 @@ from test_framework.siphash import siphash256 import dash_hash BIP0031_VERSION = 60000 -MY_VERSION = 70210 # MIN_PEER_PROTO_VERSION +MY_VERSION = 70213 # MIN_PEER_PROTO_VERSION MY_SUBVERSION = b"/python-mininode-tester:0.0.3/" MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37) diff --git a/share/setup.nsi.in b/share/setup.nsi.in index 05cec6aca2..cdd5aaf997 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -107,10 +107,6 @@ Section -post SEC0001 WriteRegStr HKCR "@PACKAGE_TARNAME@" "" "URL:Dash" WriteRegStr HKCR "@PACKAGE_TARNAME@\DefaultIcon" "" $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ WriteRegStr HKCR "@PACKAGE_TARNAME@\shell\open\command" "" '"$INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@" "%1"' - - # Delete old key (before we switched to PACKAGE_TARNAME, which is set to 'dashcore' now, we had 'dash' hardcoded) - # TODO remove this line sometime later - DeleteRegKey HKCR "dash" SectionEnd # Macro for selecting uninstaller sections @@ -150,9 +146,6 @@ Section -un.post UNSEC0001 DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" DeleteRegKey /IfEmpty HKCU "${REGKEY}" DeleteRegKey HKCR "@PACKAGE_TARNAME@" - # Delete old key (before we switched to PACKAGE_TARNAME, which is set to 'dashcore' now, we had 'dash' hardcoded) - # TODO remove this line sometime later - DeleteRegKey HKCR "dash" RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup RmDir /REBOOTOK $INSTDIR Push $R0 diff --git a/src/governance-object.cpp b/src/governance-object.cpp index 96eb441673..2593846b2f 100644 --- a/src/governance-object.cpp +++ b/src/governance-object.cpp @@ -372,9 +372,6 @@ UniValue CGovernanceObject::GetJSONObject() void CGovernanceObject::LoadData() { - // todo : 12.1 - resolved - //return; - if (vchData.empty()) { return; } diff --git a/src/governance-object.h b/src/governance-object.h index c47dc5b752..6b8e199a6b 100644 --- a/src/governance-object.h +++ b/src/governance-object.h @@ -25,7 +25,7 @@ class CGovernanceTriggerManager; class CGovernanceObject; class CGovernanceVote; -static const int MIN_GOVERNANCE_PEER_PROTO_VERSION = 70210; +static const int MIN_GOVERNANCE_PEER_PROTO_VERSION = 70213; static const int GOVERNANCE_FILTER_PROTO_VERSION = 70206; static const double GOVERNANCE_FILTER_FP_RATE = 0.001; diff --git a/src/governance-votedb.cpp b/src/governance-votedb.cpp index c45586c327..d1f528a051 100644 --- a/src/governance-votedb.cpp +++ b/src/governance-votedb.cpp @@ -89,23 +89,6 @@ std::set CGovernanceObjectVoteFile::RemoveInvalidProposalVotes(const CO return removedVotes; } -std::vector CGovernanceObjectVoteFile::RemoveOldVotes(unsigned int nMinTime) -{ - std::vector removed; - vote_l_it it = listVotes.begin(); - while (it != listVotes.end()) { - if (it->GetTimestamp() < nMinTime) { - --nMemoryVotes; - removed.emplace_back(it->GetHash()); - mapVoteIndex.erase(it->GetHash()); - listVotes.erase(it++); - } else { - ++it; - } - } - return removed; -} - void CGovernanceObjectVoteFile::RebuildIndex() { mapVoteIndex.clear(); diff --git a/src/governance-votedb.h b/src/governance-votedb.h index 5d98f826bb..5dda1ba4f1 100644 --- a/src/governance-votedb.h +++ b/src/governance-votedb.h @@ -75,9 +75,6 @@ public: void RemoveVotesFromMasternode(const COutPoint& outpointMasternode); std::set RemoveInvalidProposalVotes(const COutPoint& outpointMasternode); - // TODO can be removed after full DIP3 deployment - std::vector RemoveOldVotes(unsigned int nMinTime); - ADD_SERIALIZE_METHODS; template diff --git a/src/instantx.h b/src/instantx.h index d7ceb0e559..c8c0aa5854 100644 --- a/src/instantx.h +++ b/src/instantx.h @@ -28,7 +28,7 @@ extern CInstantSend instantsend; (1000/2900.0)**5 = 0.004875397277841433 */ -static const int MIN_INSTANTSEND_PROTO_VERSION = 70210; +static const int MIN_INSTANTSEND_PROTO_VERSION = 70213; /// For how long we are going to accept votes/locks /// after we saw the first one for a specific transaction diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 71f37b4192..7ab7c8863a 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1348,19 +1348,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr return true; } - // BEGIN TEMPORARY CODE - bool fDIP0003Active; - { - LOCK(cs_main); - fDIP0003Active = VersionBitsState(chainActive.Tip(), chainparams.GetConsensus(), Consensus::DEPLOYMENT_DIP0003, versionbitscache) == THRESHOLD_ACTIVE; - } - // TODO delete this in next release after v13 - int nMinPeerProtoVersion = MIN_PEER_PROTO_VERSION; - if (fDIP0003Active) { - nMinPeerProtoVersion = MIN_PEER_PROTO_VERSION_DIP3; - } - // END TEMPORARY CODE - if (!(pfrom->GetLocalServices() & NODE_BLOOM) && (strCommand == NetMsgType::FILTERLOAD || strCommand == NetMsgType::FILTERADD)) @@ -1448,12 +1435,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr return false; } - if (nVersion < nMinPeerProtoVersion) + if (nVersion < MIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, nVersion); connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", nMinPeerProtoVersion))); + strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION))); pfrom->fDisconnect = true; return false; } @@ -1594,17 +1581,6 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr // At this point, the outgoing message serialization version can't change. const CNetMsgMaker msgMaker(pfrom->GetSendVersion()); - // BEGIN TEMPORARY CODE - if (pfrom->nVersion < nMinPeerProtoVersion) { - // disconnect from peers with version < 70213 after DIP3 has activated through the BIP9 deployment - LogPrintf("peer=%d using obsolete version %i after DIP3 activation; disconnecting\n", pfrom->id, pfrom->GetSendVersion()); - connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", nMinPeerProtoVersion))); - pfrom->fDisconnect = true; - return false; - } - // END TEMPORARY CODE - if (strCommand == NetMsgType::VERACK) { pfrom->SetRecvVersion(std::min(pfrom->nVersion.load(), PROTOCOL_VERSION)); diff --git a/src/version.h b/src/version.h index 9c8a3441a4..3dcd1c8b7a 100644 --- a/src/version.h +++ b/src/version.h @@ -20,10 +20,7 @@ static const int INIT_PROTO_VERSION = 209; static const int GETHEADERS_VERSION = 70077; //! disconnect from peers older than this proto version -static const int MIN_PEER_PROTO_VERSION = 70210; - -//! disconnect from peers older than this proto version when DIP3 is activated via the BIP9 deployment -static const int MIN_PEER_PROTO_VERSION_DIP3 = 70213; +static const int MIN_PEER_PROTO_VERSION = 70213; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this