Skip to content

Commit

Permalink
Drop no longer used code and bump min protos (#2697)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
UdjinM6 committed Feb 12, 2019
1 parent fef8e5d commit 86fc050
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 64 deletions.
2 changes: 1 addition & 1 deletion contrib/seeds/makeseeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion qa/rpc-tests/test_framework/mininode.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
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)

Expand Down
7 changes: 0 additions & 7 deletions share/setup.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/governance-object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,6 @@ UniValue CGovernanceObject::GetJSONObject()

void CGovernanceObject::LoadData()
{
// todo : 12.1 - resolved
//return;

if (vchData.empty()) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/governance-object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 0 additions & 17 deletions src/governance-votedb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,6 @@ std::set<uint256> CGovernanceObjectVoteFile::RemoveInvalidProposalVotes(const CO
return removedVotes;
}

std::vector<uint256> CGovernanceObjectVoteFile::RemoveOldVotes(unsigned int nMinTime)
{
std::vector<uint256> 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();
Expand Down
3 changes: 0 additions & 3 deletions src/governance-votedb.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ class CGovernanceObjectVoteFile
void RemoveVotesFromMasternode(const COutPoint& outpointMasternode);
std::set<uint256> RemoveInvalidProposalVotes(const COutPoint& outpointMasternode);

// TODO can be removed after full DIP3 deployment
std::vector<uint256> RemoveOldVotes(unsigned int nMinTime);

ADD_SERIALIZE_METHODS;

template <typename Stream, typename Operation>
Expand Down
2 changes: 1 addition & 1 deletion src/instantx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 2 additions & 26 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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));
Expand Down
5 changes: 1 addition & 4 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 86fc050

Please sign in to comment.