diff --git a/configure.ac b/configure.ac index 2cb0adf7..6a1d5567 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 90) define(_CLIENT_VERSION_REVISION, 8) -define(_CLIENT_VERSION_BUILD, 10) +define(_CLIENT_VERSION_BUILD, 11) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2020) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index a64787d6..88f271cb 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -215,11 +215,9 @@ class CMainParams : public CChainParams { { 200000, uint256S("0x65c89c662dbdad4aeeb4215076884be736a7512984741b353bbdef47478305e5")}, { 215000, uint256S("0x18accc496518e6f3008eeaab7e04123939d66eb7f8a02f2fcb3d69093c1df38c")}, { 356548, uint256S("0xf62b6c5645997d078d9cb130cfe96d64ec2c047bbceca3ae8ffc373eef80b866")}, + { 550000, uint256S("0xa901848fe9d22814dbb3e0f62892d3bd7a1e70f6a48a459e68ebaf24ea5d5867")}, } }; - // FXTC BEGIN - consensus.nlastValidPowHashHeight = 999999999; - // FXTC chainTxData = ChainTxData{ // BTX: data as of block 0x8da1c7f79018fac8acac69a57b2f8b5d2743af67976a4525fdedc8c85a3a1418 (height 410476). @@ -364,9 +362,7 @@ class CTestNetParams : public CChainParams { {0, uint256S("0xe02c5d66e8edb49984eb743c798bca069466ce457b7febfa3c3a01b33353b7bc6")}, } }; - // FXTC BEGIN - consensus.nlastValidPowHashHeight = 99999999;; - // FXTC + chainTxData = ChainTxData{ // BTX: data as of block 0x8da1c7f79018fac8acac69a57b2f8b5d2743af67976a4525fdedc8c85a3a1418 (height 410476). @@ -482,9 +478,7 @@ class CRegTestParams : public CChainParams { {0, uint256S("0x604148281e5c4b7f2487e5d03cd60d8e6f69411d613f6448034508cea52e9574")}, } }; - // FXTC BEGIN - consensus.nlastValidPowHashHeight = 99999999;; - // FXTC + chainTxData = ChainTxData{ 0, diff --git a/src/consensus/params.h b/src/consensus/params.h index 05ab68af..936007f4 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -115,9 +115,6 @@ struct Params { int64_t DifficultyAdjustmentIntervalV2() const { return nPowTargetTimespanV2 / nPowTargetSpacing; } uint256 nMinimumChainWork; uint256 defaultAssumeValid; - // FXTC BEGIN - int nlastValidPowHashHeight; - // FXTC EMD }; } // namespace Consensus diff --git a/src/masternode-payments.cpp b/src/masternode-payments.cpp index 3401ee8d..680b8b0d 100644 --- a/src/masternode-payments.cpp +++ b/src/masternode-payments.cpp @@ -143,7 +143,7 @@ bool IsBlockPayeeValid(const CTransactionRef txNew, int nBlockHeight, CAmount bl // we can only check masternode payments const Consensus::Params& consensusParams = Params().GetConsensus(); - + //We should leave that here until we start the Superblocksystem. The second stage is the Spork 8 only if Superblock are online - Chris 2020 if(sporkManager.IsSporkActive(SPORK_22_MASTERNODE_PAYMENT_ENFORCEMENT)) { LogPrintf("IsBlockPayeeValid SPORK_22 -- ERROR: Invalid masternode payment detected at height %d: %s\n", nBlockHeight, txNew->ToString()); @@ -311,9 +311,23 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int nBlockH } int CMasternodePayments::GetMinMasternodePaymentsProto() { - return sporkManager.IsSporkActive(SPORK_10_MASTERNODE_PAY_UPDATED_NODES) - ? MIN_MASTERNODE_PAYMENT_PROTO_VERSION_2 - : MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1; + if (DEFAULTMINPROTO < sporkManager.GetSporkValue(SPORK_BTX_18_MIN_PEER_PROTO_VERSION)) + { + return sporkManager.GetSporkValue(SPORK_BTX_18_MIN_PEER_PROTO_VERSION); + } + else + { + return DEFAULTMINPROTO; + } +} + +int CMasternodePayments::GetFactorEnforcement() { + + if (FACTOR_ENFORCEMENT > sporkManager.GetSporkValue(SPORK_22_FACTOR_ENFORCEMENT)|| sporkManager.GetSporkValue(SPORK_22_FACTOR_ENFORCEMENT) > 200) + { + return FACTOR_ENFORCEMENT; + } + return sporkManager.GetSporkValue(SPORK_22_FACTOR_ENFORCEMENT); } void CMasternodePayments::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman) @@ -683,14 +697,7 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s return false; } - int nMinRequiredProtocol; - if(nBlockHeight >= nValidationHeight) { - // new votes must comply SPORK_10_MASTERNODE_PAY_UPDATED_NODES rules - nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto(); - } else { - // allow non-updated masternodes for old blocks - nMinRequiredProtocol = MIN_MASTERNODE_PAYMENT_PROTO_VERSION_1; - } + int nMinRequiredProtocol = mnpayments.GetMinMasternodePaymentsProto(); if(mnInfo.nProtocolVersion < nMinRequiredProtocol) { strError = strprintf("Masternode protocol is too old: nProtocolVersion=%d, nMinRequiredProtocol=%d", mnInfo.nProtocolVersion, nMinRequiredProtocol); @@ -710,13 +717,14 @@ bool CMasternodePaymentVote::IsValid(CNode* pnode, int nValidationHeight, std::s } if(nRank > MNPAYMENTS_SIGNATURES_TOTAL) { + int vCount = mnpayments.GetFactorEnforcement(); // It's common to have masternodes mistakenly think they are in the top 10 // We don't want to print all of these messages in normal mode, debug mode should print though strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL, nRank); // Only ban for new mnw which is out of bounds, for old mnw MN list itself might be way too much off - if(nRank > MNPAYMENTS_SIGNATURES_TOTAL*2 && nBlockHeight > nValidationHeight) { + if(nRank > MNPAYMENTS_SIGNATURES_TOTAL * vCount && nBlockHeight > nValidationHeight) { LOCK(cs_main); - strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL*2, nRank); + strError = strprintf("Masternode is not in the top %d (%d)", MNPAYMENTS_SIGNATURES_TOTAL * vCount, nRank); LogPrintf("CMasternodePaymentVote::IsValid -- Error: %s\n", strError); Misbehaving(pnode->GetId(), 20); } diff --git a/src/masternode-payments.h b/src/masternode-payments.h index ba1f18e0..afbe09d5 100644 --- a/src/masternode-payments.h +++ b/src/masternode-payments.h @@ -19,13 +19,13 @@ class CMasternodeBlockPayees; static const int MNPAYMENTS_SIGNATURES_REQUIRED = 6; static const int MNPAYMENTS_SIGNATURES_TOTAL = 10; +static const int DEFAULTMINPROTO = 79999; +static const int FACTOR_ENFORCEMENT = 2; //! minimum peer version that can receive and send masternode payment messages, // 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 = 70208; extern CCriticalSection cs_vecPayees; extern CCriticalSection cs_mapMasternodeBlocks; @@ -210,6 +210,7 @@ class CMasternodePayments bool CanVote(COutPoint outMasternode, int nBlockHeight); int GetMinMasternodePaymentsProto(); + int GetFactorEnforcement(); void ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv, CConnman& connman); std::string GetRequiredPaymentsString(int nBlockHeight); void FillBlockPayee(CMutableTransaction& txNew, int nBlockHeight, CAmount blockReward, CTxOut& txoutMasternodeRet); diff --git a/src/masternode.h b/src/masternode.h index 6c89d4ce..04b1857b 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -59,8 +59,8 @@ class CMasternodePing nSentinelVersion = DEFAULT_SENTINEL_VERSION; return; } - READWRITE(fSentinelIsCurrent); - READWRITE(nSentinelVersion); + //READWRITE(fSentinelIsCurrent); + //READWRITE(nSentinelVersion); } uint256 GetHash() const diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index d8071047..dbef6b3d 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -156,7 +156,7 @@ void CMasternodeMan::Check() LOCK2(cs_main, cs); // FXTC END - LogPrint(BCLog::MASTERNODE, "CMasternodeMan::Check -- nLastWatchdogVoteTime=%d, IsWatchdogActive()=%d\n", nLastWatchdogVoteTime, IsWatchdogActive()); + //LogPrint(BCLog::MASTERNODE, "CMasternodeMan::Check -- nLastWatchdogVoteTime=%d, IsWatchdogActive()=%d\n", nLastWatchdogVoteTime, IsWatchdogActive()); for (auto& mnpair : mapMasternodes) { mnpair.second.Check(); @@ -802,8 +802,8 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, const std::string& strCommand, // if masternode uses sentinel ping instead of watchdog // we shoud update nTimeLastWatchdogVote here if sentinel // ping flag is actual - if(pmn && mnp.fSentinelIsCurrent) - UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime); + //if(pmn && mnp.fSentinelIsCurrent) + // UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime); // too late, new MNANNOUNCE is required if(pmn && pmn->IsNewStartRequired()) return; @@ -1495,12 +1495,6 @@ void CMasternodeMan::UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nLastWatchdogVoteTime = GetTime(); } -bool CMasternodeMan::IsWatchdogActive() -{ - LOCK(cs); - // Check if any masternodes have voted recently, otherwise return false - return (GetTime() - nLastWatchdogVoteTime) <= MASTERNODE_WATCHDOG_MAX_SECONDS; -} bool CMasternodeMan::AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash) { @@ -1553,9 +1547,9 @@ void CMasternodeMan::SetMasternodeLastPing(const COutPoint& outpoint, const CMas // if masternode uses sentinel ping instead of watchdog // we shoud update nTimeLastWatchdogVote here if sentinel // ping flag is actual - if(mnp.fSentinelIsCurrent) { - UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime); - } + //if(mnp.fSentinelIsCurrent) { + // UpdateWatchdogVoteTime(mnp.vin.prevout, mnp.sigTime); + //} mapSeenMasternodePing.insert(std::make_pair(mnp.GetHash(), mnp)); CMasternodeBroadcast mnb(*pmn); diff --git a/src/masternodeman.h b/src/masternodeman.h index 58585b9e..a0664cc4 100644 --- a/src/masternodeman.h +++ b/src/masternodeman.h @@ -218,7 +218,6 @@ class CMasternodeMan return vecTmp;; } - bool IsWatchdogActive(); void UpdateWatchdogVoteTime(const COutPoint& outpoint, uint64_t nVoteTime = 0); bool AddGovernanceVote(const COutPoint& outpoint, uint256 nGovernanceObjectHash); void RemoveGovernanceObject(uint256 nGovernanceObjectHash); diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 4fcb8dd9..97df7883 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -969,7 +969,6 @@ UniValue getgovernanceinfo(const JSONRPCRequest& request) UniValue obj(UniValue::VOBJ); obj.push_back(Pair("governanceminquorum", Params().GetConsensus().nGovernanceMinQuorum)); - obj.push_back(Pair("masternodewatchdogmaxseconds", MASTERNODE_WATCHDOG_MAX_SECONDS)); obj.push_back(Pair("proposalfee", ValueFromAmount(GOVERNANCE_PROPOSAL_FEE_TX))); obj.push_back(Pair("superblockcycle", Params().GetConsensus().nSuperblockCycle)); obj.push_back(Pair("lastsuperblock", nLastSuperblock)); diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 7cfda5b8..729dc651 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -512,8 +512,6 @@ UniValue masternodelist(const JSONRPCRequest& request) " addr - Print ip address associated with a masternode (can be additionally filtered, partial match)\n" " full - Print info in format 'status protocol payee lastseen activeseconds lastpaidtime lastpaidblock IP'\n" " (can be additionally filtered, partial match)\n" - " info - Print info in format 'status protocol payee lastseen activeseconds sentinelversion sentinelstate IP'\n" - " (can be additionally filtered, partial match)\n" " lastpaidblock - Print the last block height a node was paid on the network\n" " lastpaidtime - Print the last time a node was paid on the network\n" " lastseen - Print timestamp of when a masternode was last seen on the network\n" @@ -581,8 +579,6 @@ UniValue masternodelist(const JSONRPCRequest& request) EncodeDestination(mn.pubKeyCollateralAddress.GetID()) << " " << (int64_t)mn.lastPing.sigTime << " " << std::setw(8) << (int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " << - SafeIntVersionToString(mn.lastPing.nSentinelVersion) << " " << - (mn.lastPing.fSentinelIsCurrent ? "current" : "expired") << " " << mn.addr.ToString(); std::string strInfo = streamInfo.str(); if (strFilter !="" && strInfo.find(strFilter) == std::string::npos && diff --git a/src/spork.cpp b/src/spork.cpp index a81a84a5..fb2800d7 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -205,7 +205,7 @@ bool CSporkManager::IsSporkActive(int nSporkID) case SPORK_BTX_19_MIN_VERSION_COUNT: r = SPORK_BTX_19_MIN_VERSION_COUNT_DEFAULT; break; case SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT: r = SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT_DEFAULT; break; case SPORK_BTX_21_MAX_VERSION_COUNT: r = SPORK_BTX_21_MAX_VERSION_COUNT_DEFAULT; break; - case SPORK_BTX_22_UNKNOW: r = SPORK_BTX_22_UNKNOW_DEFAULT; break; + case SPORK_22_FACTOR_ENFORCEMENT: r = SPORK_22_FACTOR_ENFORCEMENT_DEFAULT; break; // FXTC END default: LogPrint(BCLog::SPORK, "CSporkManager::IsSporkActive -- Unknown Spork ID %d\n", nSporkID); @@ -252,7 +252,7 @@ int64_t CSporkManager::GetSporkValue(int nSporkID) case SPORK_BTX_19_MIN_VERSION_COUNT: return SPORK_BTX_19_MIN_VERSION_COUNT_DEFAULT; case SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT: return SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT_DEFAULT; case SPORK_BTX_21_MAX_VERSION_COUNT: return SPORK_BTX_21_MAX_VERSION_COUNT_DEFAULT; - case SPORK_BTX_22_UNKNOW: return SPORK_BTX_22_UNKNOW_DEFAULT; + case SPORK_22_FACTOR_ENFORCEMENT: return SPORK_22_FACTOR_ENFORCEMENT_DEFAULT; default: LogPrint(BCLog::SPORK, "CSporkManager::GetSporkValue -- Unknown Spork ID %d\n", nSporkID); @@ -291,7 +291,7 @@ int CSporkManager::GetSporkIDByName(std::string strName) if (strName == "SPORK_BTX_19_MIN_VERSION_COUNT") return SPORK_BTX_19_MIN_VERSION_COUNT; if (strName == "SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT") return SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT; if (strName == "SPORK_BTX_21_MAX_VERSION_COUNT") return SPORK_BTX_21_MAX_VERSION_COUNT; - if (strName == "SPORK_BTX_22_UNKNOW") return SPORK_BTX_22_UNKNOW; + if (strName == "SPORK_22_FACTOR_ENFORCEMENT") return SPORK_22_FACTOR_ENFORCEMENT; LogPrint(BCLog::SPORK, "CSporkManager::GetSporkIDByName -- Unknown Spork name '%s'\n", strName); return -1; @@ -328,7 +328,7 @@ std::string CSporkManager::GetSporkNameByID(int nSporkID) case SPORK_BTX_19_MIN_VERSION_COUNT: return "SPORK_BTX_19_MIN_VERSION_COUNT"; case SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT: return "SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT"; case SPORK_BTX_21_MAX_VERSION_COUNT: return "SPORK_BTX_21_MAX_VERSION_COUNT"; - case SPORK_BTX_22_UNKNOW: return "SPORK_BTX_22_UNKNOW"; + case SPORK_22_FACTOR_ENFORCEMENT: return "SPORK_22_FACTOR_ENFORCEMENT"; default: LogPrint(BCLog::SPORK, "CSporkManager::GetSporkNameByID -- Unknown Spork ID %d\n", nSporkID); diff --git a/src/spork.h b/src/spork.h index e2765f1b..3e098c10 100644 --- a/src/spork.h +++ b/src/spork.h @@ -59,7 +59,7 @@ static const int SPORK_BTX_18_MIN_PEER_PROTO_VERSION = 94680031; static const int SPORK_BTX_19_MIN_VERSION_COUNT = 94680032; static const int SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT = 94680026; static const int SPORK_BTX_21_MAX_VERSION_COUNT = 94680027; -static const int SPORK_BTX_22_UNKNOW = 94680028; +static const int SPORK_22_FACTOR_ENFORCEMENT = 94680028; // FXTC END static const int64_t SPORK_2_INSTANTSEND_ENABLED_DEFAULT = 0; // ON @@ -90,7 +90,7 @@ static const int64_t SPORK_BTX_18_MIN_PEER_PROTO_VERSION_DEFAULT = 70016;// OFF static const int64_t SPORK_BTX_19_MIN_VERSION_COUNT_DEFAULT = 4070908800ULL;// OFF static const int64_t SPORK_BTX_20_MIN_FOR_WORK_VERSION_COUNT_DEFAULT = 4070908800ULL;// OFF static const int64_t SPORK_BTX_21_MAX_VERSION_COUNT_DEFAULT = 4070908800ULL;// OFF -static const int64_t SPORK_BTX_22_UNKNOW_DEFAULT = 4070908800ULL;// OFF +static const int64_t SPORK_22_FACTOR_ENFORCEMENT_DEFAULT = 4070908800ULL;// OFF diff --git a/src/txdb.cpp b/src/txdb.cpp index c6b02bd4..fd0c6565 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -274,9 +274,6 @@ bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, pindexNew->nStatus = diskindex.nStatus; pindexNew->nTx = diskindex.nTx; - // BitCore BEGIN - if (pindexNew->nHeight > consensusParams.nlastValidPowHashHeight) - // FXTC END if (!CheckProofOfWork(pindexNew->GetBlockPoWHash(), pindexNew->nBits, consensusParams)) return error("%s: CheckProofOfWork failed: %s", __func__, pindexNew->ToString()); diff --git a/src/validation.cpp b/src/validation.cpp index 25d83357..fcaa506f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3660,7 +3660,7 @@ bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState& if (pindexPrev->nStatus & BLOCK_FAILED_MASK) return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk"); // FXTC BEGIN - if (fCheckpointsEnabled && pindexPrev->nHeight < chainparams.GetConsensus().nlastValidPowHashHeight && !Checkpoints::IsExpectedCheckpoint(chainparams.Checkpoints(), pindexPrev->nHeight + 1, block.GetHash())) + if (fCheckpointsEnabled && !Checkpoints::IsExpectedCheckpoint(chainparams.Checkpoints(), pindexPrev->nHeight + 1, block.GetHash())) return state.DoS(100, error("%s: Checkpoints::IsExpectedCheckpoint(): invalid checkpoint at height %d", __func__, pindexPrev->nHeight + 1), REJECT_CHECKPOINT, "bad-chackpoint"); // FXTC END if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev, GetAdjustedTime()))