From 621f9ebeca7a3430d9f80c9fd43bdde378e5485c Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 11 Jan 2017 03:33:01 +0400 Subject: [PATCH] remove GetEstimatedMasternodes and GetTotalCoinEstimate (#1258) --- src/main.cpp | 25 ------------------------- src/main.h | 1 - src/masternode-sync.cpp | 15 --------------- src/masternodeman.cpp | 22 ---------------------- src/masternodeman.h | 2 -- 5 files changed, 65 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d287816ac..306bcad77 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1704,31 +1704,6 @@ double ConvertBitsToDouble(unsigned int nBits) return dDiff; } -int64_t GetTotalCoinEstimate(int nHeight) -{ - int64_t nTotalCoins = 0; - - // TODO: This could be vastly improved, look at GetBlockValue for a better method - - /* these values are taken from the block explorer */ - if(nHeight > 5076) nTotalCoins += 2021642; - if(nHeight > 17000) nTotalCoins += 3267692-2021642; - if(nHeight > 34000) nTotalCoins += 3688775-3267692; - if(nHeight > 68000) nTotalCoins += 4277615-3688775; - - if(nHeight > 68000*2) { - nTotalCoins += 4649913.99999995-4277615; - } else { - return nTotalCoins; - } - - //5.383754730451325 per block average after this - nTotalCoins += ((nHeight-68000*2)*((5382104.64334133-4649913.99999995)/(68000*2))); - - // TODO: this should include the 7.1% decline too - return nTotalCoins; -} - /* NOTE: unlike bitcoin we are using PREVIOUS block height here, might be a good idea to change this to use prev bits diff --git a/src/main.h b/src/main.h index 28cc64977..9d7dbddb4 100644 --- a/src/main.h +++ b/src/main.h @@ -251,7 +251,6 @@ bool GetTransaction(const uint256 &hash, CTransaction &tx, const Consensus::Para bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams, const CBlock* pblock = NULL); double ConvertBitsToDouble(unsigned int nBits); -int64_t GetTotalCoinEstimate(int nHeight); CAmount GetBlockSubsidy(int nBits, int nHeight, const Consensus::Params& consensusParams, bool fSuperblockPartOnly = false); CAmount GetMasternodePayment(int nHeight, CAmount blockValue); diff --git a/src/masternode-sync.cpp b/src/masternode-sync.cpp index d886f6dd0..7cdd74ab5 100644 --- a/src/masternode-sync.cpp +++ b/src/masternode-sync.cpp @@ -348,21 +348,6 @@ void CMasternodeSync::ProcessTick() return; } - // check for data - // if we have enough masternodes in or list, switch to the next asset - /* Note: Is this activing up? It's probably related to int CMasternodeMan::GetEstimatedMasternodes(int nBlock) - Surely doesn't work right for testnet currently */ - // try to fetch data from at least two peers though - int nMnCountEstimated = mnodeman.GetEstimatedMasternodes(pCurrentBlockIndex->nHeight)*0.9; - LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nMnCount %d nMnCountEstimated %d\n", - nTick, nMnCount, nMnCountEstimated); - if(nRequestedMasternodeAttempt > 1 && nMnCount > nMnCountEstimated) { - LogPrintf("CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- found enough data\n", nTick, nRequestedMasternodeAssets); - SwitchToNextAsset(); - ReleaseNodes(vNodesCopy); - return; - } - // only request once from each peer if(netfulfilledman.HasFulfilledRequest(pnode->addr, "masternode-list-sync")) continue; netfulfilledman.AddFulfilledRequest(pnode->addr, "masternode-list-sync"); diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 2872232de..2ffb27bcf 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -1327,28 +1327,6 @@ std::string CMasternodeMan::ToString() const return info.str(); } -int CMasternodeMan::GetEstimatedMasternodes(int nBlock) -{ - /* - Masternodes = (Coins/1000)*X on average - - *X = nPercentage, starting at 0.52 - nPercentage goes up 0.01 each period - Period starts at 35040, which has exponential slowing growth - - */ - - int nPercentage = 52; //0.52 - int nPeriod = 35040; - int nCollateral = 1000; - - for (int i = nPeriod; i <= nBlock; i += nPeriod) { - nPercentage++; - nPeriod*=2; - } - return (GetTotalCoinEstimate(nBlock)/100*nPercentage/nCollateral); -} - void CMasternodeMan::UpdateMasternodeList(CMasternodeBroadcast mnb) { LOCK(cs); diff --git a/src/masternodeman.h b/src/masternodeman.h index 0ac437ff8..ecb4bc976 100644 --- a/src/masternodeman.h +++ b/src/masternodeman.h @@ -310,8 +310,6 @@ public: std::string ToString() const; - int GetEstimatedMasternodes(int nBlock); - /// Update masternode list and maps using provided CMasternodeBroadcast void UpdateMasternodeList(CMasternodeBroadcast mnb); /// Perform complete check and only then update list and maps