From dd6ab9e270142e8cfa7bf1d65ea1b49d2356df2c Mon Sep 17 00:00:00 2001 From: mclxi Date: Fri, 15 Jun 2018 08:44:56 +0000 Subject: [PATCH] coin burn --- configure.ac | 6 +- src/chainparams.cpp | 6 +- src/clientversion.h | 2 +- src/governance-object.h | 4 +- src/governance-vote.h | 2 +- src/instantx.cpp | 29 ++++- src/masternode-payments.cpp | 2 +- src/masternode-payments.h | 4 +- src/masternode-sync.cpp | 4 +- src/masternode.h | 10 +- src/masternodeman.cpp | 6 +- src/net.cpp | 8 +- src/net_processing.cpp | 11 +- src/privatesend-client.cpp | 87 ++++++++++++--- src/privatesend-server.cpp | 56 ++++++++-- src/privatesend.cpp | 19 +++- src/privatesend.h | 4 +- src/qt/clientmodel.cpp | 2 +- src/rpc/masternode.cpp | 10 +- src/spork.h | 4 +- src/validation.cpp | 210 ++++++++++++++++++++++++++++++++---- src/validation.h | 48 +++++++++ src/version.h | 4 +- 23 files changed, 448 insertions(+), 90 deletions(-) diff --git a/configure.ac b/configure.ac index 3893fcc48..5a5768417 100644 --- a/configure.ac +++ b/configure.ac @@ -2,9 +2,9 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) -define(_CLIENT_VERSION_MINOR, 4) -define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 1) +define(_CLIENT_VERSION_MINOR, 5) +define(_CLIENT_VERSION_REVISION, 0) +define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2017) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 1c8ec9625..cccec092f 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -132,7 +132,7 @@ class CMainParams : public CChainParams { consensus.nBudgetPaymentsStartBlock = 32800; // actual historical value consensus.nBudgetPaymentsCycleBlocks = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725 consensus.nBudgetPaymentsWindowBlocks = 100; - consensus.nSuperblockStartBlock = 6646384784; // The block at which 12.1 goes live (end of final 12.0 budget cycle) + consensus.nSuperblockStartBlock = 66384784; // The block at which 12.1 goes live (end of final 12.0 budget cycle) consensus.nSuperblockCycle = 16616; // ~(60*24*30)/2.6, actual number of blocks per month is 200700 / 12 = 16725 consensus.nSuperblockStartHash = uint256S("0000000000000a7d13390bb29ac6d4466afb16358aeb3cd0656215392ed2468d"); consensus.nGovernanceMinQuorum = 10; @@ -144,6 +144,8 @@ class CMainParams : public CChainParams { consensus.BIP66Height = 245817; // 00000000000b1fa2dfa312863570e13fae9ca7b5566cb27e55422620b469aefa consensus.DIP0001Height = 782208; consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000"); + //consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); // ~uint256(0) >> 1 + consensus.nPowTargetTimespan = 120; // aced: 120 seconds consensus.nPowTargetSpacing = 120 ; // aced: 2.5 minutes consensus.fPowAllowMinDifficultyBlocks = false; @@ -220,7 +222,7 @@ class CMainParams : public CChainParams { vFixedSeeds = std::vector(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main)); - fMiningRequiresPeers = true; + fMiningRequiresPeers = false; fDefaultConsistencyChecks = false; fRequireStandard = true; fMineBlocksOnDemand = false; diff --git a/src/clientversion.h b/src/clientversion.h index 1c57bcb92..2944bfb43 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -55,7 +55,7 @@ static const int CLIENT_VERSION = 1000000 * CLIENT_VERSION_MAJOR - + 10000 * 4 + + 10000 * 5 + 100 * 1 + 1 * 1; diff --git a/src/governance-object.h b/src/governance-object.h index bf02d222a..43cb4f79d 100644 --- a/src/governance-object.h +++ b/src/governance-object.h @@ -310,7 +310,7 @@ class CGovernanceObject READWRITE(nRevision); READWRITE(nTime); READWRITE(nCollateralHash); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format std::string strDataHex; if (ser_action.ForRead()) { @@ -325,7 +325,7 @@ class CGovernanceObject READWRITE(vchData); } READWRITE(nObjectType); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin; if (ser_action.ForRead()) { diff --git a/src/governance-vote.h b/src/governance-vote.h index 9d36c270b..3305afdaa 100644 --- a/src/governance-vote.h +++ b/src/governance-vote.h @@ -158,7 +158,7 @@ class CGovernanceVote template inline void SerializationOp(Stream& s, Operation ser_action) { int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin{}; if (ser_action.ForRead()) { diff --git a/src/instantx.cpp b/src/instantx.cpp index b286dbe6b..65594cc54 100644 --- a/src/instantx.cpp +++ b/src/instantx.cpp @@ -57,10 +57,17 @@ void CInstantSend::ProcessMessage(CNode* pfrom, const std::string& strCommand, C if (strCommand == NetMsgType::TXLOCKVOTE) // InstantSend Transaction Lock Consensus Votes { - if(pfrom->nVersion < MIN_INSTANTSEND_PROTO_VERSION) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } + + if(pfrom->nVersion < catcher) { LogPrint("instantsend", "TXLOCKVOTE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_INSTANTSEND_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } @@ -233,7 +240,14 @@ void CInstantSend::Vote(CTxLockCandidate& txLockCandidate, CConnman& connman) int nLockInputHeight = nPrevoutHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2; int nRank; - if(!mnodeman.GetMasternodeRank(activeMasternode.outpoint, nRank, nLockInputHeight, MIN_INSTANTSEND_PROTO_VERSION)) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } + + if(!mnodeman.GetMasternodeRank(activeMasternode.outpoint, nRank, nLockInputHeight, catcher)) { LogPrint("instantsend", "CInstantSend::Vote -- Can't calculate rank for masternode %s\n", activeMasternode.outpoint.ToStringShort()); ++itOutpointLock; continue; @@ -1041,7 +1055,14 @@ bool CTxLockVote::IsValid(CNode* pnode, CConnman& connman) const int nLockInputHeight = coin.nHeight + Params().GetConsensus().nInstantSendConfirmationsRequired - 2; int nRank; - if(!mnodeman.GetMasternodeRank(outpointMasternode, nRank, nLockInputHeight, MIN_INSTANTSEND_PROTO_VERSION)) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } + + if(!mnodeman.GetMasternodeRank(outpointMasternode, nRank, nLockInputHeight, catcher)) { //can be caused by past versions trying to vote with an invalid protocol LogPrint("instantsend", "CTxLockVote::IsValid -- Can't calculate rank for masternode %s\n", outpointMasternode.ToStringShort()); return false; diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 62b5c7156..05451e1e9 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -308,7 +308,7 @@ void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCom if (!masternodeSync.IsSynced()) return; // DEPRECATED, should be removed on next protocol bump - if(pfrom->nVersion == 70209) { + if(pfrom->nVersion == 70209 || pfrom->nVersion == 70210) { int nCountNeeded; vRecv >> nCountNeeded; } diff --git a/src/masternode-payments.h b/src/masternode-payments.h index 34c153133..da45c6b31 100644 --- a/src/masternode-payments.h +++ b/src/masternode-payments.h @@ -23,8 +23,8 @@ static const int MNPAYMENTS_SIGNATURES_TOTAL = 10; // vote for masternode and be elected as a payment winner // V1 - Last protocol version before update // V2 - Newest protocol version -static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70206; -static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70209; +static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1 = 70209; +static const int MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 = 70210; extern CCriticalSection cs_vecPayees; extern CCriticalSection cs_mapMasternodeBlocks; diff --git a/src/masternode-sync.cpp b/src/masternode-sync.cpp index 5fd7b14cd..79f634cf7 100644 --- a/src/masternode-sync.cpp +++ b/src/masternode-sync.cpp @@ -203,7 +203,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman) mnodeman.DsegUpdate(pnode, connman); } else if(nRequestedMasternodeAttempt < 6) { //sync payment votes - if(pnode->nVersion == 70209) { + if(pnode->nVersion == 70209 || pnode->nVersion == 70210) { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC, mnpayments.GetStorageLimit())); //sync payment votes } else { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC)); //sync payment votes @@ -325,7 +325,7 @@ void CMasternodeSync::ProcessTick(CConnman& connman) // ask node for all payment votes it has (new nodes will only return votes for future payments) //sync payment votes - if(pnode->nVersion == 70209) { + if(pnode->nVersion == 70209 || pnode->nVersion == 70210) { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC, mnpayments.GetStorageLimit())); } else { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC)); diff --git a/src/masternode.h b/src/masternode.h index 45ab5cfb6..3190f75ac 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -52,7 +52,7 @@ class CMasternodePing template inline void SerializationOp(Stream& s, Operation ser_action) { int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin{}; if (ser_action.ForRead()) { @@ -85,7 +85,7 @@ class CMasternodePing nDaemonVersion = DEFAULT_DAEMON_VERSION; return; } - if (!(nVersion == 70209 && (s.GetType() & SER_NETWORK))) { + if (!(nVersion >= 70209 && (s.GetType() & SER_NETWORK))) { READWRITE(nDaemonVersion); } } @@ -204,7 +204,7 @@ class CMasternode : public masternode_info_t inline void SerializationOp(Stream& s, Operation ser_action) { LOCK(cs); int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin{}; if (ser_action.ForRead()) { @@ -362,7 +362,7 @@ class CMasternodeBroadcast : public CMasternode template inline void SerializationOp(Stream& s, Operation ser_action) { int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin{}; if (ser_action.ForRead()) { @@ -429,7 +429,7 @@ class CMasternodeVerification template inline void SerializationOp(Stream& s, Operation ser_action) { int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin1{}; CTxIn txin2{}; diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index ad2c3480a..645824f45 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -114,7 +114,7 @@ void CMasternodeMan::AskForMN(CNode* pnode, const COutPoint& outpoint, CConnman& } mWeAskedForMasternodeListEntry[outpoint][addrSquashed] = GetTime() + DSEG_UPDATE_SECONDS; - if (pnode->GetSendVersion() == 70209) { + if (pnode->GetSendVersion() == 70209 || pnode->GetSendVersion() == 70210) { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, CTxIn(outpoint))); } else { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, outpoint)); @@ -430,7 +430,7 @@ void CMasternodeMan::DsegUpdate(CNode* pnode, CConnman& connman) } } - if (pnode->GetSendVersion() == 70209) { + if (pnode->GetSendVersion() == 70209 || pnode->GetSendVersion() == 70210) { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, CTxIn())); } else { connman.PushMessage(pnode, msgMaker.Make(NetMsgType::DSEG, COutPoint())); @@ -884,7 +884,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, const std::string& strCommand, COutPoint masternodeOutpoint; - if (pfrom->nVersion == 70209) { + if (pfrom->nVersion == 70209 || pfrom->nVersion == 70210) { CTxIn vin; vRecv >> vin; masternodeOutpoint = vin.prevout; diff --git a/src/net.cpp b/src/net.cpp index 0415c4252..80bfd31f1 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2612,8 +2612,14 @@ void CConnman::RelayTransaction(const CTransaction& tx) void CConnman::RelayInv(CInv &inv, const int minProtoVersion) { LOCK(cs_vNodes); + int minproto; + if (chainActive.Height() < 17170) { + minproto = 70209; + } else { + minproto = 70210; + } for (const auto& pnode : vNodes) - if(pnode->nVersion >= minProtoVersion) + if(pnode->nVersion >= minproto) pnode->PushInventory(inv); } diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 75004d0b3..de7de93e5 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1208,13 +1208,18 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr pfrom->fDisconnect = true; return false; } - //if (nTime > 1527292800) { //friday may 25 00:00:00 GMT - if (nVersion < MIN_PEER_PROTO_VERSION) + int minproto; + if (chainActive.Height() < 17170) { //friday may 25 00:00:00 GMT + minproto=70209; + } else { + minproto=70210; + } + if (nVersion < minproto) { // 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", MIN_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", minproto))); pfrom->fDisconnect = true; return false; } diff --git a/src/privatesend-client.cpp b/src/privatesend-client.cpp index 42de773d9..cc9023977 100644 --- a/src/privatesend-client.cpp +++ b/src/privatesend-client.cpp @@ -30,11 +30,17 @@ void CPrivateSendClient::ProcessMessage(CNode* pfrom, const std::string& strComm if(strCommand == NetMsgType::DSQUEUE) { TRY_LOCK(cs_darksend, lockRecv); if(!lockRecv) return; + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } @@ -82,8 +88,14 @@ void CPrivateSendClient::ProcessMessage(CNode* pfrom, const std::string& strComm return; } } + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - int nThreshold = infoMn.nLastDsq + mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION)/5; + int nThreshold = infoMn.nLastDsq + mnodeman.CountEnabled(catcher)/5; LogPrint("privatesend", "DSQUEUE -- nLastDsq: %d threshold: %d nDsqCount: %d\n", infoMn.nLastDsq, nThreshold, mnodeman.nDsqCount); //don't allow a few nodes to dominate the queuing process if(infoMn.nLastDsq != 0 && nThreshold > mnodeman.nDsqCount) { @@ -102,11 +114,17 @@ void CPrivateSendClient::ProcessMessage(CNode* pfrom, const std::string& strComm } } else if(strCommand == NetMsgType::DSSTATUSUPDATE) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSSTATUSUPDATE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } @@ -146,11 +164,17 @@ void CPrivateSendClient::ProcessMessage(CNode* pfrom, const std::string& strComm } } else if(strCommand == NetMsgType::DSFINALTX) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSFINALTX -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } @@ -175,11 +199,17 @@ void CPrivateSendClient::ProcessMessage(CNode* pfrom, const std::string& strComm SignFinalTransaction(txNew, pfrom, connman); } else if(strCommand == NetMsgType::DSCOMPLETE) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSCOMPLETE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } @@ -802,8 +832,14 @@ bool CPrivateSendClient::DoAutomaticDenominating(CConnman& connman, bool fDryRun } } } + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - int nMnCountEnabled = mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION); + int nMnCountEnabled = mnodeman.CountEnabled(catcher); // If we've used 90% of the Masternode list then drop the oldest first ~30% int nThreshold_high = nMnCountEnabled * 0.9; @@ -847,8 +883,14 @@ bool CPrivateSendClient::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, CCon LogPrintf("CPrivateSendClient::JoinExistingQueue -- dsq masternode is not in masternode list, masternode=%s\n", dsq.masternodeOutpoint.ToStringShort()); continue; } + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } - if(infoMn.nProtocolVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) continue; + if(infoMn.nProtocolVersion < catcher) continue; // skip next mn payments winners if (mnpayments.IsScheduled(infoMn, 0)) { @@ -889,7 +931,7 @@ bool CPrivateSendClient::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, CCon infoMixingMasternode = infoMn; pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CDarksendAccept(nSessionDenom, txMyCollateral)); connman.AddPendingMasternode(infoMn.addr); - // TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION + // TODO: add new state POOL_STATE_CONNECTING and bump catcher SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); LogPrintf("CPrivateSendClient::JoinExistingQueue -- pending connection (from queue): nSessionDenom: %d (%s), addr=%s\n", @@ -904,7 +946,14 @@ bool CPrivateSendClient::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, CCon bool CPrivateSendClient::StartNewQueue(CAmount nValueMin, CAmount nBalanceNeedsAnonymized, CConnman& connman) { int nTries = 0; - int nMnCountEnabled = mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION); + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } + + int nMnCountEnabled = mnodeman.CountEnabled(catcher); // ** find the coins we'll use std::vector vecTxIn; @@ -915,10 +964,16 @@ bool CPrivateSendClient::StartNewQueue(CAmount nValueMin, CAmount nBalanceNeedsA strAutoDenomResult = _("Can't mix: no compatible inputs found!"); return false; } +// int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } // otherwise, try one randomly while(nTries < 10) { - masternode_info_t infoMn = mnodeman.FindRandomNotInVec(vecMasternodesUsed, MIN_PRIVATESEND_PEER_PROTO_VERSION); + masternode_info_t infoMn = mnodeman.FindRandomNotInVec(vecMasternodesUsed, catcher); if(!infoMn.fInfoValid) { LogPrintf("CPrivateSendClient::StartNewQueue -- Can't find random masternode!\n"); @@ -962,7 +1017,7 @@ bool CPrivateSendClient::StartNewQueue(CAmount nValueMin, CAmount nBalanceNeedsA infoMixingMasternode = infoMn; connman.AddPendingMasternode(infoMn.addr); pendingDsaRequest = CPendingDsaRequest(infoMn.addr, CDarksendAccept(nSessionDenom, txMyCollateral)); - // TODO: add new state POOL_STATE_CONNECTING and bump MIN_PRIVATESEND_PEER_PROTO_VERSION + // TODO: add new state POOL_STATE_CONNECTING and bump catcher SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); LogPrintf("CPrivateSendClient::StartNewQueue -- pending connection, nSessionDenom: %d (%s), addr=%s\n", @@ -981,7 +1036,7 @@ void CPrivateSendClient::ProcessPendingDsaRequest(CConnman& connman) bool fDone = connman.ForNode(pendingDsaRequest.GetAddr(), [&](CNode* pnode) { LogPrint("privatesend", "-- processing dsa queue for addr=%s\n", pnode->addr.ToString()); nTimeLastSuccessfulStep = GetTime(); - // TODO: this vvvv should be here after new state POOL_STATE_CONNECTING is added and MIN_PRIVATESEND_PEER_PROTO_VERSION is bumped + // TODO: this vvvv should be here after new state POOL_STATE_CONNECTING is added and catcher is bumped // SetState(POOL_STATE_QUEUE); strAutoDenomResult = _("Mixing in progress..."); CNetMsgMaker msgMaker(pnode->GetSendVersion()); diff --git a/src/privatesend-server.cpp b/src/privatesend-server.cpp index 2885df8f7..6002b958a 100644 --- a/src/privatesend-server.cpp +++ b/src/privatesend-server.cpp @@ -25,11 +25,17 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm if(!masternodeSync.IsBlockchainSynced()) return; if(strCommand == NetMsgType::DSACCEPT) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSACCEPT -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); PushStatus(pfrom, STATUS_REJECTED, ERR_VERSION, connman); return; } @@ -51,9 +57,15 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm PushStatus(pfrom, STATUS_REJECTED, ERR_MN_LIST, connman); return; } +// int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } if(vecSessionCollaterals.size() == 0 && mnInfo.nLastDsq != 0 && - mnInfo.nLastDsq + mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION)/5 > mnodeman.nDsqCount) + mnInfo.nLastDsq + mnodeman.CountEnabled(catcher)/5 > mnodeman.nDsqCount) { LogPrintf("DSACCEPT -- last dsq too recent, must wait: addr=%s\n", pfrom->addr.ToString()); PushStatus(pfrom, STATUS_REJECTED, ERR_RECENT, connman); @@ -77,11 +89,17 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } else if(strCommand == NetMsgType::DSQUEUE) { TRY_LOCK(cs_darksend, lockRecv); if(!lockRecv) return; + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSQUEUE -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } @@ -117,8 +135,14 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm return; } } + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } - int nThreshold = mnInfo.nLastDsq + mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION)/5; + int nThreshold = mnInfo.nLastDsq + mnodeman.CountEnabled(catcher)/5; LogPrint("privatesend", "DSQUEUE -- nLastDsq: %d threshold: %d nDsqCount: %d\n", mnInfo.nLastDsq, nThreshold, mnodeman.nDsqCount); //don't allow a few nodes to dominate the queuing process if(mnInfo.nLastDsq != 0 && nThreshold > mnodeman.nDsqCount) { @@ -133,11 +157,17 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } } else if(strCommand == NetMsgType::DSVIN) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSVIN -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); PushStatus(pfrom, STATUS_REJECTED, ERR_VERSION, connman); return; } @@ -233,11 +263,17 @@ void CPrivateSendServer::ProcessMessage(CNode* pfrom, const std::string& strComm } } else if(strCommand == NetMsgType::DSSIGNFINALTX) { + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } - if(pfrom->nVersion < MIN_PRIVATESEND_PEER_PROTO_VERSION) { + if(pfrom->nVersion < catcher) { LogPrint("privatesend", "DSSIGNFINALTX -- peer=%d using obsolete version %i\n", pfrom->id, pfrom->nVersion); connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::REJECT, strCommand, REJECT_OBSOLETE, - strprintf("Version must be %d or greater", MIN_PRIVATESEND_PEER_PROTO_VERSION))); + strprintf("Version must be %d or greater", catcher))); return; } diff --git a/src/privatesend.cpp b/src/privatesend.cpp index 8518221b3..8b8c58e3a 100644 --- a/src/privatesend.cpp +++ b/src/privatesend.cpp @@ -266,8 +266,13 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral) for (const auto& txout : txCollateral.vout) { nValueOut += txout.nValue; - - bool fAllowData = mnpayments.GetMinMasternodePaymentsProto() > 70209; + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } + bool fAllowData = mnpayments.GetMinMasternodePaymentsProto() > catcher; if(!txout.scriptPubKey.IsPayToPublicKeyHash() && !(fAllowData && txout.scriptPubKey.IsUnspendable())) { LogPrintf ("CPrivateSend::IsCollateralValid -- Invalid Script, txCollateral=%s", txCollateral.ToString()); return false; @@ -305,7 +310,15 @@ bool CPrivateSend::IsCollateralValid(const CTransaction& txCollateral) bool CPrivateSend::IsCollateralAmount(CAmount nInputAmount) { - if (mnpayments.GetMinMasternodePaymentsProto() > 70209) { + + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + }else { + catcher=70210; + } + + if (mnpayments.GetMinMasternodePaymentsProto() > catcher) { // collateral input can be anything between 1x and "max" (including both) return (nInputAmount >= GetCollateralAmount() && nInputAmount <= GetMaxCollateralAmount()); } else { // <= 70208 diff --git a/src/privatesend.h b/src/privatesend.h index 4f1936963..5ab9c0af1 100644 --- a/src/privatesend.h +++ b/src/privatesend.h @@ -200,7 +200,7 @@ class CDarksendQueue inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(nDenom); int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin{}; if (ser_action.ForRead()) { @@ -287,7 +287,7 @@ class CDarksendBroadcastTx inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(tx); int nVersion = s.GetVersion(); - if (nVersion == 70209 && (s.GetType() & SER_NETWORK)) { + if (nVersion >= 70209 && (s.GetType() & SER_NETWORK)) { // converting from/to old format CTxIn txin{}; if (ser_action.ForRead()) { diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 5f6672104..e3121e790 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -85,7 +85,7 @@ QString ClientModel::getMasternodeCountString() const // return tr("Total: %1 (PS compatible: %2 / Enabled: %3) (IPv4: %4, IPv6: %5, TOR: %6)").arg(QString::number((int)mnodeman.size())) return tr("Total: %1 (PS compatible: %2 / Enabled: %3)") .arg(QString::number((int)mnodeman.size())) - .arg(QString::number((int)mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION))) + .arg(QString::number((int)mnodeman.CountEnabled(70210))) .arg(QString::number((int)mnodeman.CountEnabled())); // .arg(QString::number((int)mnodeman.CountByIP(NET_IPV4))) // .arg(QString::number((int)mnodeman.CountByIP(NET_IPV6))) diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 09b55a9c8..ca7fb8de8 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -196,7 +196,13 @@ UniValue masternode(const JSONRPCRequest& request) mnodeman.GetNextMasternodeInQueueForPayment(true, nCount, mnInfo); int total = mnodeman.size(); - int ps = mnodeman.CountEnabled(MIN_PRIVATESEND_PEER_PROTO_VERSION); + int catcher; + if (chainActive.Height() < 17170){ + catcher=70209; + } else { + catcher=70210; + } + int ps = mnodeman.CountEnabled(catcher); int enabled = mnodeman.CountEnabled(); if (request.params.size() == 1) { @@ -946,4 +952,4 @@ void RegisterMasternodeRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); -} \ No newline at end of file +} diff --git a/src/spork.h b/src/spork.h index 3c158f276..a22cfbe24 100644 --- a/src/spork.h +++ b/src/spork.h @@ -35,10 +35,10 @@ static const int SPORK_15_MASTERNODE_LOCK_NUMBER = 10014; static const int64_t SPORK_2_INSTANTSEND_ENABLED_DEFAULT = 0; // ON static const int64_t SPORK_3_INSTANTSEND_BLOCK_FILTERING_DEFAULT = 0; // ON static const int64_t SPORK_5_INSTANTSEND_MAX_VALUE_DEFAULT = 1000; // 1000 ACED -static const int64_t SPORK_6_NEW_SIGS_DEFAULT = 0;// OFF +static const int64_t SPORK_6_NEW_SIGS_DEFAULT = 4070908800ULL;// OFF static const int64_t SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT = 0; // ON static const int64_t SPORK_9_SUPERBLOCKS_ENABLED_DEFAULT = 4070908800ULL;// OFF -static const int64_t SPORK_10_MASTERNODE_PAY_UPDATED_NODES_DEFAULT = 1527292800;// FRIDAY MAY 25 00:00:00 GMT +static const int64_t SPORK_10_MASTERNODE_PAY_UPDATED_NODES_DEFAULT = 1529100000;// FRIDAY MAY 25 00:00:00 GMT static const int64_t SPORK_12_RECONSIDER_BLOCKS_DEFAULT = 0; // 0 BLOCKS static const int64_t SPORK_14_REQUIRE_SENTINEL_FLAG_DEFAULT = 4070908800ULL;// OFF static const int64_t SPORK_15_MASTERNODE_LOCK_NUMBER_DEFAULT = 2000; // LOCK THE AMMOUNT OF MN ON 2000 diff --git a/src/validation.cpp b/src/validation.cpp index 6839ae4ff..2a8712917 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -38,6 +38,7 @@ #include "validationinterface.h" #include "versionbits.h" #include "warnings.h" +#include "base58.h" #include "instantx.h" #include "masternodeman.h" @@ -219,6 +220,126 @@ CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& loc } return chain.Genesis(); } +/*bool HF_IsBlocked(const CScript& scriptPubKey) { + CTxDestination dest; + ExtractDestination(scriptPubKey, dest); + CBitcoinAddress txAddr(dest); + std::string txAddrStr = txAddr.ToString(); + + BOOST_FOREACH(const std::string addr, HF_blAddrs) { + if (txAddrStr == addr) { + return true; + } + } + + return false; +} +*/ +/* +bool HF_CheckTX(const CTransaction& tx, int n) { + if (tx.IsCoinBase()) { + // skip + return true; + } + + BOOST_FOREACH(const CTxIn &txin, tx.vin) { + CTransaction prevTx; + uint256 prevTxBlockHash; + + if (!GetTransaction(txin.prevout.hash, prevTx, Params().GetConsensus(), prevTxBlockHash, true)) { + return false; + } + + BlockMap::iterator mi = mapBlockIndex.find(prevTxBlockHash); + if(mi == mapBlockIndex.end() || !mi->second) { + return false; + } + + if (mi->second->nHeight <= HF_ACTIVATION_BLOCK+1) { + if (prevTx.IsCoinBase() && HF_IsBlocked(prevTx.vout[txin.prevout.n].scriptPubKey)) { + return false; + } + + if (!HF_CheckTX(prevTx, txin.prevout.n)) { + return false; + } + } + } + + return true; +}*/ +/*bool HF_CheckTX(const CTransaction *tx, int n) { + if (tx->IsCoinBase()) { + // skip + return true; + } + + BOOST_FOREACH(const CTxIn &txin, tx->vin) { + CTransaction prevTx; + uint256 prevTxBlockHash; + + if (!GetTransaction(txin.prevout.hash, MakeTransactionRef(std::move(prevTx)), Params().GetConsensus(), prevTxBlockHash, true)) { + return false; + } + + BlockMap::iterator mi = mapBlockIndex.find(prevTxBlockHash); + if(mi == mapBlockIndex.end() || !mi->second) { + return false; + } + + if (mi->second->nHeight <= HF_ACTIVATION_BLOCK+1) { + if (prevTx.IsCoinBase() && HF_IsBlocked(prevTx.vout[txin.prevout.n].scriptPubKey)) { + return false; + } + + if (!HF_CheckTX(prevTx, txin.prevout.n)) { + return false; + } + } + } + + return true; +} +*/ +/* +bool HF_CheckTX(const CTransactionRef& tx2, int n) { + const CTransaction* tx = tx2.get(); + if (tx->IsCoinBase()) { + // skip + return true; + } + BOOST_FOREACH(const CTxIn &txin, tx->vin) { + CTransactionRef prevTx2; +//auto const prevTx = std::dynamic_pointer_cast(prevTx2); + //CTransaction prevTx; + const CTransaction* prevTx=prevTx2.get(); + uint256 prevTxBlockHash; + //CTransactionRef wee= MakeTransactionRef(tx); + //CTransactionRef prevTx; + if (!GetTransaction(txin.prevout.hash, prevTx2, Params().GetConsensus(), prevTxBlockHash, true)) { + return false; + } + + BlockMap::iterator mi = mapBlockIndex.find(prevTxBlockHash); + if(mi == mapBlockIndex.end() || !mi->second) { + return false; + } + + if (mi->second->nHeight <= HF_ACTIVATION_BLOCK+1) { + if (prevTx->IsCoinBase() && HF_IsBlocked(prevTx->vout[txin.prevout.n].scriptPubKey)) { + return false; + } + //CTransactionRef wee2 = prevTx2; + if (!HF_CheckTX(prevTx2, txin.prevout.n)) { + return false; + } + } + } + + return true; +} +*/ + CCoinsViewDB *pcoinsdbview = NULL; CCoinsViewCache *pcoinsTip = NULL; @@ -993,6 +1114,12 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C FormatMoney(::incrementalRelayFee.GetFee(nSize)))); } } + //CTransactionRef wee = MakeTransactionRef(tx); + if (chainActive.Height() >= HF_ACTIVATION_BLOCK){ + if (!HF_CheckTX(tx)) { + return false; + } + } // If we aren't going to actually accept it but just were verifying it, we are fine already if(fDryRun) return true; @@ -1297,7 +1424,11 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params& if(nPrevHeight > 6000) {nSubsidyBase = 20;} if(nPrevHeight == 10079) {nSubsidyBase = 2000;} if(nPrevHeight == 15119) {nSubsidyBase = 2000;} - if(nPrevHeight == 20159) {nSubsidyBase = 2000;} + if(nPrevHeight == 17170) {nSubsidyBase = 19;} + if(nPrevHeight == 17171) {nSubsidyBase = 21;} + if(nPrevHeight > 1314000) {nSubsidyBase = 2;} + if(nPrevHeight > 2628000) {nSubsidyBase = 0.1;} + /* if(nPrevHeight == 20159) {nSubsidyBase = 2000;} if(nPrevHeight == 40319) {nSubsidyBase = 5000;} if(nPrevHeight == 60479) {nSubsidyBase = 5000;} if(nPrevHeight == 80639) {nSubsidyBase = 5000;} @@ -1313,7 +1444,7 @@ CAmount GetBlockSubsidy(int nPrevBits, int nPrevHeight, const Consensus::Params& if(nPrevHeight == 725759) {nSubsidyBase = 10000;} if(nPrevHeight == 967679) {nSubsidyBase = 10000;} if(nPrevHeight == 1209599) {nSubsidyBase = 10000;} - + */ // LogPrintf("height %u diff %4.2f reward %d\n", nPrevHeight, dDiff, nSubsidyBase); CAmount nSubsidy = nSubsidyBase * COIN; @@ -2372,7 +2503,8 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd return true; } -/*bool HF_IsBlocked(const CScript& scriptPubKey) { + +bool HF_IsBlocked(const CScript& scriptPubKey) { CTxDestination dest; ExtractDestination(scriptPubKey, dest); CBitcoinAddress txAddr(dest); @@ -2380,45 +2512,71 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd BOOST_FOREACH(const std::string addr, HF_blAddrs) { if (txAddrStr == addr) { + LogPrintf("debug my ass\n"); return true; } } return false; } -bool HF_CheckTX(const CTransaction& tx, int n) { + +bool HF_CheckTX(const CTransaction& tx) { if (tx.IsCoinBase()) { // skip return true; } - BOOST_FOREACH(const CTxIn &txin, tx.vin) { - CTransaction prevTx; + BOOST_FOREACH(const CTxIn &txin, tx.vin) { + CTransactionRef wtxPrev2; uint256 prevTxBlockHash; - - if (!GetTransaction(txin.prevout.hash, prevTx, Params().GetConsensus(), prevTxBlockHash, true)) { - return false; - } - - BlockMap::iterator mi = mapBlockIndex.find(prevTxBlockHash); - if(mi == mapBlockIndex.end() || !mi->second) { - return false; - } - - if (mi->second->nHeight <= HF_ACTIVATION_BLOCK+1) { - if (prevTx.IsCoinBase() && HF_IsBlocked(prevTx.vout[txin.prevout.n].scriptPubKey)) { - return false; + //GetTransaction(vin.prevout.hash, wtxPrev)){ // get the vin's previous transaction + GetTransaction(txin.prevout.hash, wtxPrev2, Params().GetConsensus(), prevTxBlockHash, true); + CTxDestination source; + const CTransaction* wtxPrev = wtxPrev2.get(); + ExtractDestination(wtxPrev->vout[txin.prevout.n].scriptPubKey, source); // extract the destination of the previous transaction's vout[n] + CBitcoinAddress addressSource(source); // convert this to an address + CScript blocker = GetScriptForDestination(addressSource.Get()); + + if (HF_IsBlocked(blocker)) { + //LogPrintf("CheckDevFundPayment -- Found required payment: %s\n", txNew.ToString().c_str()); + //fFound = true; + // break; + LogPrintf("nonpointer works\n"); + return false; } + } + return true; +} +bool HF_CheckTXpointer(const CTransactionRef& tx2) { + const CTransaction* tx = tx2.get(); + if (tx->IsCoinBase()) { + // skip + return true; + } - if (!HF_CheckTX(prevTx, txin.prevout.n)) { + BOOST_FOREACH(const CTxIn &txin, tx->vin) { + CTransactionRef wtxPrev2; + uint256 prevTxBlockHash; + //GetTransaction(vin.prevout.hash, wtxPrev)){ // get the vin's previous transaction + GetTransaction(txin.prevout.hash, wtxPrev2, Params().GetConsensus(), prevTxBlockHash, true); + CTxDestination source; + const CTransaction* wtxPrev = wtxPrev2.get(); + ExtractDestination(wtxPrev->vout[txin.prevout.n].scriptPubKey, source); // extract the destination of the previous transaction's vout[$ + CBitcoinAddress addressSource(source); // convert this to an address + CScript blocker = GetScriptForDestination(addressSource.Get()); + + if (HF_IsBlocked(blocker)) { + //LogPrintf("CheckDevFundPayment -- Found required payment: %s\n", txNew.ToString().c_str()); + //fFound = true; + // break; + LogPrintf("pointer code works\n"); return false; } } - } return true; } -*/ + /** * Update the on-disk chain state. * The caches and indexes are flushed depending on the mode we're called with @@ -3637,6 +3795,14 @@ static bool AcceptBlock(const std::shared_ptr& pblock, CValidation } } }*/ + if (nHeight >= HF_ACTIVATION_BLOCK) { + // BOOST_FOREACH(const CTransaction&tx, block.vtx) { + for (const auto& tx : block.vtx) { + if (!HF_CheckTXpointer(tx)) { + return false; + } + } + } // Write block to history file try { unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); diff --git a/src/validation.h b/src/validation.h index a5bb4dd80..9548bbce4 100644 --- a/src/validation.h +++ b/src/validation.h @@ -501,7 +501,55 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Co /** Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) */ bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true); +static const int HF_ACTIVATION_BLOCK = 17170; +static const std::string HF_blAddrs[] = { + /* "LfdfsdfsdfsdfsfsdfsdfLVUft158tEM24", + "LR8hSKspkNy5gYHyxwrmXnfbdzCFw73oLc", + "LLKDVHRDeWXiYHRXUTTnGXFHXKPqwN5f7J", + "Lg8VLzP6c8MeqpGDC5pLqBbqaLVtMarNq3", + "Ldw3tr4nDaJQztBr1dLAs8u6bzQqpac7L1", + "LYUHVBsHA88S8kufUuN1Q9GEAkrNcz8bLv", + "LLdf4j6jvVsBJw5wGCRyCRQmouYGpytmkd", + "LPWGchfjBPxVr7VBH1DkMfV6XFzFDP93Kh", + "LW9bK2zVhKdzBP2x4gjapms55aqmudqevc", + "LSQHaZUyLPXtn8z2e1VEcwbJyzLYHH7GKy"*/ +"AcJGaB6aTik1D48UzkEFKrxh6fKmWo8GBR", +"Aaq1fXFMFGR6h2LaPk2jtx9KtKCg8WG76Z", +"ARdcktKEF22zSQBSrkFLfMxdmPznkbG1JD", +"AMqSShP4VBb1ds8mGZQt1Whb5rVZ1Vbf8x", +"AV4a4YSiaJDMfMVwnVTzE7o1oJzQYA5M1T", +"ALXgBSf9Qz5DmvSngZkbUwem5pcvi6PV9D", +"ANPXTed1ZSvMWLigKEgmJhdrYEEa6JDiG3", +"Abyi4FMkvZgWkPBhsF97p6GqftCGp9Rvij", +"AU4cBo81vMm5foT9aRc15SK9ZtFAPh8Lew", +"AJSqsZWkjxpzadsnqqBUDi48wNcfmc43PB", +"AeAf3G5YiAyPqK8DTa1rmRABLa7CH7P1Eo", +"AG9NJavcAyFDejYoA55aJPKEcz42QNhiYP", +"AeQjnHhXz77emMULURUGgRuAhi1PwGbvLz", +"AcCp4LPg4d7wesW5imqxRSNfSQwQPQQSP3", +"Aah7doj9ZibvmD33GX5GQiRrvSyXPz2o6z", +"ASGBuws7BD7NCDsQEnTxLFLKi5zV9DLnPe", +"AemYmU8Xk4r2ZaCoQXy81gGBBZ6t44Hrij", +"AHP7NiMHJP1t3HytGRMVkeMyT5tPGu6HYh", +"AemnvxmKKfdKCneHXfnK36HCYwU4892sHe", +"AKtPbSEu1nqKwqw31px4MBiGCEV13gdusr", +"ANoGjG3mvvM2DDtHto6aN8BXTtGPBvjJVb", +"Af2vFnGN56ooe7A1wmw2igGxYGruS1kyHo", +"ASWG1BZqVSFJRcXKCQYxNVSfZmtkdw74NF", +"AaHpsCJgEUiZfubTmJM7omRhZ4wMByeSEq", +"AKfgu7GZRyKRf4KZhx6wHutpMza6yY4Dfn", +"AGcWUo2D3Cf6oWWPs13AuxAg6UomimF8pW", +"AYDGMp8479aXhRqnDBiJw14jDgaRXzbuev", +"ARMyPc2HTiumGPLnEiofzbnsyzdND8yEwR", +"AM99mfQvSc72ZFGenBgg66U6sa6VjcZ33g", +"AMEXoa3sdndHfrzD7zrPRgxXK7ewxS5N3w", +"AUgGR4wsuz1a6fFztxjiCDocBSTVhMS9fJ", +"ARurP5TKFX1ibfQJt3bAfm88yxwA3evVhK" +}; +bool HF_IsBlocked(const CScript& scriptPubKey); +bool HF_CheckTX(const CTransaction& tx); +bool HF_CheckTXpointer(const CTransactionRef& tx2); /** RAII wrapper for VerifyDB: Verify consistency of the block and coin databases */ class CVerifyDB { public: diff --git a/src/version.h b/src/version.h index 0b31e4cb6..bc0b0477b 100644 --- a/src/version.h +++ b/src/version.h @@ -10,7 +10,7 @@ * network protocol versioning */ -static const int PROTOCOL_VERSION = 70209; +static const int PROTOCOL_VERSION = 70210; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; @@ -19,7 +19,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 = 70209; +static const int MIN_PEER_PROTO_VERSION = 70210; //! nTime field added to CAddress, starting with this version; //! if possible, avoid requesting addresses nodes older than this